www.pudn.com > QQ.zip > AddUser.asp, change:2009-07-11,size:2843b


<!--#include file="conn.asp"--> 
<% 
  if session("admin")="" then 
    Response.Write("<script>alert('用户未登录,请登录!');top.location='../login.asp';</script>") 
	Response.end 
  end if 
  if Session("login_UserType")<>2 then 
    Response.Write("<script>alert('没有权限,执行失败!');history.back();</script>") 
	Response.end 
  end if 
  set rs=server.CreateObject("adodb.recordset") 
  if request.Form.count>0 then 
    '提交 
	 sql="select id from tb_User_Info where UserName='" & replace(Request.form("UserName"),"'","''") &"'" 
	 rs.open sql,conn,1,1 
	 if rs.recordcount>0 then 
	    rs.close 
		Response.Write("<script>alert('用户已存在,添加失败!');history.back();</script>") 
		Response.end 
	 end if 
	 rs.close 
	 sql="insert into tb_User_Info (UserName,PWD,RealName,isDisabled,UserType) values('" & replace(Request.form("UserName"),"'","''") &"','" & replace(Request.form("PassWord"),"'","''") &"','" & replace(Request.form("RealName"),"'","''") &"'," & replace(Request.form("isDisabled"),"'","''") &"," & replace(Request.form("UserType"),"'","''") &")" 
	 conn.execute sql 
	 Response.redirect("UserList.asp") 
  end if    
%> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
<title>无标题文档</title> 
</head> 
 
<body> 
<table width="100%"  border="1"> 
  <form name="form1" method="post" action="">  
  <tr> 
    <td colspan="2"><div align="center">用户增加页面</div></td> 
  </tr> 
  <tr> 
    <td width="20%" align="right">用户名:</td> 
    <td width="80%"> 
      <input name="UserName" type="text" id="UserName" maxlength="20">    </td> 
  </tr> 
  <tr> 
    <td align="right">密 码:</td> 
    <td><input name="PassWord" type="password" id="PassWord" maxlength="20"></td> 
  </tr> 
  <tr> 
    <td align="right">密码确认:</td> 
    <td><input name="PassWord1" type="password" id="PassWord1" maxlength="20"></td> 
  </tr> 
  <tr> 
    <td align="right">真实姓名:</td> 
    <td><input name="RealName" type="text" id="UserName3" maxlength="20"></td> 
  </tr> 
  <tr> 
    <td align="right">用户类型:</td> 
    <td><select name="UserType"> 
      <option value="0" selected>新闻编辑</option> 
      <option value="1">类别管理员</option> 
      <option value="2">系统管理员</option> 
    </select></td> 
  </tr> 
  <tr> 
    <td align="right">帐号状态:</td> 
    <td><input name="isDisabled" type="radio" value="0" checked> 
      启用 
        <input type="radio" name="isDisabled" value="1"> 
      禁用</td> 
  </tr> 
  <tr> 
    <td colspan="2"><div align="center"> 
        
        
      <input type="submit" name="Submit" value="添加">  
      <input type="reset" name="Submit2" value="重置"> 
    </div></td> 
    </tr> 
  </form> 
</table> 
</body> 
</html>