⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 useradd.asp

📁 目前人力资源管理系统的发展已经相对成熟
💻 ASP
字号:
<!--#include file=DataBase/conn.asp-->
<!--#include file=yan.asp-->
<!--#include file=purview.asp-->
<%
call tianjiayonghu
if request("post")<>"" then
	'判断字段是否为空
	if request("nameid")="" then
		response.Write("<script language=javascript>alert('没有员工不能进行添加');location='javascript:history.go(-1)'</script>")
		response.End()
	end if
	if request("username")="" then
		response.Write("<script language=javascript>alert('用户名必须填写');location='javascript:history.go(-1)'</script>")
		response.End()
	end if
	if request("userpwd")="" then
		response.Write("<script language=javascript>alert('密码必须填写');location='javascript:history.go(-1)'</script>")
		response.End()
	end if
	if request("userpwd")<>request("userpwd2") then
		response.Write("<script language=javascript>alert('两次输入密码不一致');location='javascript:history.go(-1)'</script>")
		response.End()
	end if
	'判断用户名是否存在
	set rsy=server.CreateObject("adodb.recordset")
	sqly="select * from tb_User where username='"&request("username")&"'"
	rsy.open sqly,conn,1,1
	if not rsy.eof then
		response.Write("<script language=javascript>alert('用户名已经存在');location='javascript:history.go(-1)'</script>")
		response.End()
	end if
	'添加用户
	set rsa=server.CreateObject("adodb.recordset")
	sqla="select * from tb_User"
	rsa.open sqla,conn,1,3
	rsa.addnew
	rsa("username")=request("username")
	rsa("userpwd")=request("userpwd")
	rsa("name")=request("nameid")
	rsa("chaoji")=request("chaoji")
	rsa.update
	rsa.close
	set rsa1=server.CreateObject("adodb.recordset")
	sqla1="select * from tb_Employee where id="&request("nameid")
	rsa1.open sqla1,conn,1,3
	rsa1("uj")=1
	rsa1.update
	rsa1.close
	response.Write("<script language=javascript>alert('用户添加成功!')</script>")
end if
'员工
set rs=server.CreateObject("adodb.recordset")
sql="select * from tb_Employee where kong=1 and (uj is null)"
rs.open sql,conn,1,1 
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<link href="CSS/css.css" rel="stylesheet" type="text/css">
<script language="javascript">
function more()
{
var id=form1.nameid.value;
      window.open("employeeopen.asp?id="+id,"","width=450,height=450,toolbar=no,location=no,status=no,menubar=no");
}
</script>
<style type="text/css">
<!--
body,td,th {
	font-size: 12px;
}
.style1 {
	font-size: 13px;
	font-weight: bold;
	color: #FF0000;
}
-->
</style></head>

<body>
<form name="form1" method="post" action="">
  <table width="468"  border="0" align="center" cellspacing="1" bgcolor="#000000">
    <tr>
      <td bgcolor="#FFFFFF"><table width="468" height="189"  border="0" align="center" cellspacing="0" >
        <tr align="center" >
          <td height="27" colspan="2" background="images/index_24.gif"><span class="style1">添加用户</span></td>
        </tr>
        <tr>
          <td width="39%" height="28"><div align="right">用户名:</div></td>
          <td width="61%">&nbsp;
              <input name="username" type="text" class="wenben" id="username">
              <input name="post" type="hidden" id="post" value="true"></td>
        </tr>
        <tr>
          <td height="28"><div align="right">密码:</div></td>
          <td>&nbsp;
              <input name="userpwd" type="password" class="wenben" id="userpwd"></td>
        </tr>
        <tr>
          <td height="28" align="right">确认密码:</td>
          <td>&nbsp;
              <input name="userpwd2" type="password" class="wenben" id="userpwd2"></td>
        </tr>
        <tr>
          <td height="12"><div align="right">对应人员:</div></td>
          <td>&nbsp;
              <%  if not rs.eof then %>
              <select name="nameid" id="nameid">
                <%
		 
       do while not rs.eof 
	  %>
                <option value="<%=rs("id")%>"><%=rs("name")%></option>
                <%
	 rs.movenext
	 loop
	 %>
              </select>
              <input name="Submit3" type="button" class="botton" value=" 详细资料 " onClick="more()">
              <%else%>
      没有员工
      <%end if%>
          </td>
        </tr>
        <tr align="center">
          <td height="24" colspan="2"><input name="chaoji" type="radio" value="0" checked>
      普通用户
        <input type="radio" name="chaoji" value="1">
      超级管理员</td>
        </tr>
        <tr align="center">
          <td colspan="2"><input name="Submit" type="submit" class="botton" value="添加">
       
        <input name="Submit2" type="reset" class="botton" value="重置"></td>
        </tr>
      </table></td>
    </tr>
  </table>
</form>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -