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

📄 admin_adduser.asp

📁 网站 QCNEWS后台管理程序,风格流行功能强大
💻 ASP
字号:
<!--#include file="admin_head.asp"-->
<!--#include file="md5.asp"-->
<br><br>
<%
if request("method") = 1 then
	Unid = Request.Form("Unid")
	if Trim(Request.Form("username")) = "" then
		Errmsg = "<li>请输入用户名。"
		FoundErr = true
	else
		username = Qcdn.checkStr(Trim(Request.Form("username")))
	end if
	if Trim(Request.Form("pass1")) = "" or Trim(Request.Form("pass2")) = "" then
		Errmsg = Errmsg + "<li>请输入密码及确认密码。"
		FoundErr = true
	elseif Trim(Request.Form("pass1"))<>Trim(Request.Form("pass2")) then
		Errmsg = Errmsg + "<li>输入的密码和确认密码不符。"
		FoundErr = true
	else
		password = Qcdn.checkStr(Trim(Request.Form("pass1")))
		password = md5(password,16)
	end if
	if Request.Form("flag") = "" then
		Errmsg = Errmsg + "<li>发生异常错误。<li>错误编号为: error 104。<li>请和青创网络联系解决问题。"
		FoundErr = true
	else
		flag = Request.Form("flag")
	end if
	if FoundErr then
		Call Qcdn.Err_List(Errmsg,1)
		Response.end
	end if
	
	if Unid = "" then
		Sql = "Select id from article_admin where username = '"& username &"'"
		set rs = conn.execute(Sql)
		if rs.eof and rs.bof then
			sqlstr = "insert into article_admin(username,[password],flag)values('"& username &"','"& password &"',"& flag &")"
			Conn.execute(sqlstr)
			Response.Write("<script>alert(""添加用户成功"");location.href=""Admin_user.asp"";</script>")
			Response.End()
		else
			Errmsg = "<li>您输入的用户名,数据库中已经存在了。"
			Call Qcdn.Err_List(Errmsg,1)
			Response.end
		end if
		Rs.close
	else
		sql = "Update article_admin set username = '"& username &"',[password] = '"& password &"',flag = "& flag &" where id = " & Unid
		conn.execute(sql)
		Response.write("<script>alert(""修改成功"");location.href=""admin_user.asp"";</script>")
		Response.end
	end if
end if
Unid = Request("Unid")
if Unid = "" then
%>
<table width="95%" border="1" cellspacing="0" cellpadding="3" align="center" bordercolorlight="#ECEEE4" bordercolordark="#CCCABC">
<form name="form1" action="" method="post">
  <tr> 
    <td colspan="7" align="center" height="30" background="image/tablebg.gif"><b>添 
      加 用 户 信 息</b> </td>
  </tr>
  <tr> 
    <td width="20%" height="25">用&nbsp;户&nbsp;名:</td>
    <td height="25">
<input name="username" type="text" id="username" size="30" maxlength="20"></td>
  </tr>
  <tr> 
    <td height="25">密&nbsp;&nbsp;&nbsp;&nbsp;码:</td>
    <td height="25">
<input name="pass1" type="password" id="pass1" size="30" maxlength="20"></td>
  </tr>
  <tr> 
    <td height="25">确认密码:</td>
    <td height="25">
<input name="pass2" type="password" id="pass2" size="30" maxlength="20"></td>
  </tr>
  <tr> 
    <td height="25">管理权限:</td>
    <td height="25"> <input type="radio" name="flag" value="1">
      管理员 
      <input type="radio" name="flag" value="2">
      审核员 
      <input name="flag" type="radio" value="3" checked>
      录入员</td>
  </tr>
  <tr> 
    <td height="25" colspan="2" align="center"><input type="submit" name="Submit" value="提交" class="tbutton">
      <input type="reset" name="Submit2" value="重置" class="tbutton"></td>
  </tr>
  <input type="hidden" name="method" value="1">
  </form>
</table>
<%
else
sql = "Select username,flag from article_admin where id = " & Unid
set rs = conn.execute(sql)
if not rs.eof then
	username = rs(0)
	flag = rs(1)
	rs.close
end if
%>
<table width="95%" border="1" cellspacing="0" cellpadding="3" align="center" bordercolorlight="#ECEEE4" bordercolordark="#CCCABC">
<form name="form1" action="" method="post">
<input type="hidden" name="unid" value="<%=Unid%>">
  <tr> 
    <td colspan="7" align="center" height="30" background="image/tablebg.gif"><b>修 改 用 户 信 息</b> </td>
  </tr>
  <tr> 
    <td width="20%" height="25">用&nbsp;户&nbsp;名:</td>
    <td height="25">
<input name="username" type="text" id="username" size="30" maxlength="20" value="<%=username%>"></td>
  </tr>
  <tr> 
    <td height="25">密&nbsp;&nbsp;&nbsp;&nbsp;码:</td>
    <td height="25">
<input name="pass1" type="password" id="pass1" size="30" maxlength="20"></td>
  </tr>
  <tr> 
    <td height="25">确认密码:</td>
    <td height="25">
<input name="pass2" type="password" id="pass2" size="30" maxlength="20"></td>
  </tr>
  <tr> 
    <td height="25">管理权限:</td>
    <td height="25"> <input type="radio" name="flag" value="1" <%if flag = 1 then Response.write "checked"%>>
      管理员 
      <input type="radio" name="flag" value="2" <%if flag = 2 then Response.write "checked"%>>
      审核员 
      <input name="flag" type="radio" value="3" <%if flag = 3 then Response.write "checked"%>>
      录入员</td>
  </tr>
  <tr> 
    <td height="25" colspan="2" align="center"><input type="submit" name="Submit" value="提交" class="tbutton">
      <input type="reset" name="Submit2" value="重置" class="tbutton"></td>
  </tr>
  <input type="hidden" name="method" value="1">
  </form>
</table>
<%end if%>
<!--#include file="admin_copy.asp"-->

⌨️ 快捷键说明

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