📄 addadmin.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="config.asp"-->
<!--#include file="md5.asp"-->
<!--#include file="top.asp"-->
<%
if Cint(Request.Cookies("IsSuper"))<>1 then
Response.Redirect("Default.asp")
Response.End()
End If
select case request("action")
case "saveedit"
call saveedit()
case else
call normal()
end select
sub normal()
dim id,rs,adminname,adminpwd,adminqx,IsSuper
id=request("id")
adminqx="0|||0|||0|||0|||0|||0|||0|||0|||0|||0|||0|||"
if id<>"" then
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from admin where id="&id&"",conn,1,1
if rs.bof and rs.eof then
response.Write("<script>alert('用户不存在或已被删除!');history.back()</script>")
response.End()
end if
adminname=rs("adminname")
adminpwd=rs("adminpassword")
IsSuper=rs("IsSuper")
adminqx=rs("AdminGroup")
end if
adminqx=split(adminqx,"|||")
response.Write("<table width='770' border='0' align='center' cellpadding='0' cellspacing='1' class='tablecolor'>")
response.Write("<tr class='banner'><td height='25' align='center' >管理管理员</td></tr></table>")
response.Write("<table width='770' border='0' align='center' cellpadding='3' cellspacing='1' class='tablecolor'>")
response.Write("<form name='form1' method='post' action='?action=saveedit'>")
response.Write("<tr class='tablebody'><td width='200' height='25' align='center'>管理员名称</td><td ><input name='adminname' type='text' id='adminname' value='"&adminname&"' maxlength='20'")
if adminname<>"" then response.Write("readonly")
response.Write("></td></tr>")
response.Write("<tr class='tablebody'><td height='25' align='center' >管理员密码</td><td><input name='adminpwd' type='password' value='"&adminpwd&"' maxlength='20'> 至少6位</td></tr>")
response.Write("<tr class='tablebody'><td height='25' align='center' >管理员权限</td><td>")
response.Write("<input name='G0' type='checkbox' value=1")
if Cint(adminqx(0))=1 then response.Write(" checked")
response.Write("> 网站设置 <input name='G1' type='checkbox' value=1")
if Cint(adminqx(1))=1 then response.Write(" checked")
response.Write("> 新闻管理 <input name='G2' type='checkbox' value=1")
if Cint(adminqx(2))=1 then response.Write(" checked")
response.Write("> 产品管理 <input name='G3' type='checkbox' value=1")
if Cint(adminqx(3))=1 then response.Write(" checked")
response.Write("> 留言管理 <br><input name='G4' type='checkbox' value=1")
if Cint(adminqx(4))=1 then response.Write(" checked")
response.Write("> 会员管理 <input name='G5' type='checkbox' value=1")
if Cint(adminqx(5))=1 then response.Write(" checked")
response.Write("> 友情联接 <input name='G6' type='checkbox' value=1")
if Cint(adminqx(6))=1 then response.Write(" checked")
response.Write("> 招聘管理 <input name='G7' type='checkbox' value=1")
if Cint(adminqx(7))=1 then response.Write(" checked")
response.Write("> 定单管理 <br><input name='G8' type='checkbox' value=1")
if Cint(adminqx(8))=1 then response.Write(" checked")
response.Write("> 营销网络 <input name='G9' type='checkbox' value=1")
if Cint(adminqx(9))=1 then response.Write(" checked")
response.Write("> 反馈信息 <input name='G10' type='checkbox' value=1")
if Cint(adminqx(10))=1 then response.Write(" checked")
response.Write("> 网站调查 ")
response.Write("<input name='IsSuper' type='checkbox' value=1")
if IsSuper=1 then response.Write(" checked")
response.Write("> <font color=red>超级管理员</font></td></tr>")
response.Write("<tr class='tablebody'><td height='25' align='center' > </td><td><input type='hidden' name='id' value='"&id&"'><input type='submit' name='Submit' value='提 交'> <input type='reset' name='Submit2' value='重 置'></td></tr></form></table>")
end sub
sub saveedit()
dim adminname,adminpwd,id,adminqx
id=checkStr(request.Form("id"))
adminname=checkStr(Request.Form("adminname"))
adminpwd=checkStr(Request.Form("adminpwd"))
For i=0 to 10
adminqx=adminqx&Cint(Request.Form("G"&i))&"|||"
next
if adminname="" then
response.Write("<script>alert('用户名不能为空!');history.back()</script>")
response.End()
end if
if len(adminpwd)<6 then
response.Write("<script>alert('密码小于6位!');history.back()</script>")
response.End()
end if
dim rs
set rs=server.CreateObject("adodb.recordset")
if id="" then
rs.open "select * from admin where adminname='"&adminname&"'",conn,1,3
if not rs.bof and not rs.eof then
response.Write("<script>alert('用户名已存在!');history.back()</script>")
response.End()
end if
rs.addnew
rs("adminname")=adminname
rs("adminpassword")=md5(adminpwd)
rs("AdminGroup")=adminqx
rs("IsSuper")=Cint(Request.Form("IsSuper"))
rs.update
rs.close
set rs=nothing
response.Write("<script>alert('添加成功!');location='admin.asp'</script>")
response.End()
else
rs.open "select * from admin where id="&id&"",conn,1,3
rs("adminname")=adminname
if adminpwd<>rs("adminpassword") then
rs("adminpassword")=md5(adminpwd)
end if
rs("AdminGroup")=adminqx
rs("IsSuper")=Cint(Request.Form("IsSuper"))
rs.update
rs.close
set rs=nothing
response.Write("<script>alert('修改成功!');location='admin.asp'</script>")
response.End()
end if
end sub
%>
<%CloseConn%>
<!--#include file="end.asp"-->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -