📄 admin_adminmod.asp
字号:
<%
Option Explicit
Response.buffer=true
const purviewlevel=1
%>
<!--#include file="admin_PurviewChe.asp" -->
<!--#include file="../inc/md5.asp" -->
<!--#include file="../inc/function.asp" -->
<!--#include file="conn.asp" -->
<%
dim adminid,adminmod
adminid=trim(request("adminid"))
if adminid="" then
response.redirect("admin_AdminMan.asp")
call closeconn()
end if
adminmod=trim(request.form("adminmod"))
if adminmod="mod" then
dim adminname,oldadminname,oldpass,password,adminpass,adminpurview,founderr,errmsg
adminname=trim(request.form("adminname"))
oldadminname=trim(request.form("oldadminname"))
oldpass=trim(request.form("oldpass"))
oldpass=md5(oldpass)
password=trim(request.form("password"))
adminpass=trim(request.form("adminpass"))
adminpurview=trim(request.form("adminpurview"))
if adminname="" or strlength(adminname)>20 or strlength(adminname)<6 then
founderr=true
errmsg=errmsg & "<br><li>请输入用户名(不能小于6而大于20)</li>"
else
if instr(adminname,"=")>0 or instr(adminname,"%")>0 or instr(adminname,"'")>0 or instr(adminname,"?")>0 or instr(adminname,"&")>0 or instr(adminname,";")>0 or instr(adminname,",")>0 or instr(adminname," ")>0 or instr(adminname,"$")>0 or instr(adminname,chr(34))>0 or instr(adminname,chr(32))>0 or instr(adminname,chr(9))>0 then
founderr=true
errmsg=errmsg + "<br><li>用户名中含有非法字符!</li>"
end if
end if
if oldpass="" or strlength(oldpass)<6 or strlength(oldpass)>50 then
founderr=true
errmsg=errmsg + "<br><li>请输入旧密码(密码不能小于6而大于50)</li>"
else
if instr(oldpass,"=")>0 or instr(oldpass,"%")>0 or instr(oldpass,"'")>0 or instr(oldpass,"?")>0 or instr(oldpass,"&")>0 or instr(oldpass,";")>0 or instr(oldpass,",")>0 or instr(oldpass," ")>0 or instr(oldpass,"$")>0 or instr(oldpass,chr(34))>0 or instr(oldpass,chr(32))>0 or instr(oldpass,chr(9))>0 then
founderr=true
errmsg=errmsg + "<br><li>密码中含有非法字符!</li>"
end if
end if
if password="" or strLength(password)<6 or strlength(password)>50 then
founderr=true
errmsg=errmsg + "<br><li>请输入密码(密码不能小于6而大于50)</li>"
else
if instr(password,"=")>0 or instr(password,"%")>0 or instr(password,"'")>0 or instr(password,"?")>0 or instr(password,"&")>0 or instr(password,";")>0 or instr(password,",")>0 or instr(password," ")>0 or instr(password,"$")>0 or instr(password,chr(34))>0 or instr(password,chr(32))>0 or instr(password,chr(9))>0 then
founderr=true
errmsg=errmsg + "<br><li>密码中含有非法字符!</li>"
end if
end if
if adminpass="" then
founderr=true
errmsg=errmsg + "<br><li>请输入确认密码!</li>"
else
if password<>adminpass then
founderr=true
errmsg=errmsg + "<br><li>两次输入的密码不一致!</li>"
end if
end if
if adminpurview="" then
founderr=true
errmsg=errmsg + "<br><li>管理员权限不能为空!</li>"
end if
if founderr=false then
dim rs
set rs=server.createobject("ADODB.Recordset")
rs.open"select * from admin where adminid="&adminid&"",conn,1,3
if rs("adminpass")<>oldpass then
founderr=true
errmsg=errmsg + "<br><li>旧密码不对!</li>"
else
adminpass=md5(adminpass)
rs("adminname")=adminname
rs("adminpass")=adminpass
rs("adminpurview")=adminpurview
rs.update
conn.execute"update bigclass set bmanager='"&adminname&"' where bmanager='"&oldadminname&"'"
conn.execute"update smallclass set smanager='"&adminname&"' where smanager='"&oldadminname&"'"
conn.execute"update article set editor='"&adminname&"' where editor='"&oldadminname&"'"
founderr=false
end if
if founderr=false then
call regsuccess()
else
call writeerrmsg()
end if
rs.close
set rs=nothing
call closeconn()
end if
end if
%>
<%
sub regsuccess()
response.write"<br><table align='center' width='350' border='0' cellpadding='2' cellspacing='0'>"
response.write"<tr class='txt1'><td align='center'>修改成功!</td></tr>"
response.write"<tr class='txt05'><td align='center'>你的用户名是:"&adminname&"<br></td></tr>"
response.write"<tr class='txt05'><td align='center'><br>【<a href='admin_AdminMan.asp'>返回管理面板</a>】</td></tr>"
response.end()
end sub
sub writeerrmsg()
response.write"<br><table align='center' width='350' border='0' cellpadding='2' cellspacing='0'>"
response.write"<tr class='txt04'><td align='center'>可能是以下的原因,导致修改失败!</td></tr>"
response.write"<tr class='txt05'><td >"&errmsg&"</td></tr>"
response.write"<tr class='txt05'><td align='center'><br>【<a href='admin_AdminMan.asp'>返回</a>】</td></tr>"
response.end()
end sub
%>
<%dim rsmod
set rsmod=conn.execute("select * from admin where adminid="&adminid&"")
if rsmod.eof or rsmod.bof then
founderr=true
errmsg=errmsg + "<br><li>该管理员不存在!</li>"
else
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<link href="Style.css" rel="stylesheet" type="text/css">
<script language=javascript>
function checkform()
{
if (window.document.form1.adminname.value=="")
{
alert("帐号不能为空!");
return false;
}
if (window.document.form1.oldpass.value=="")
{
alert("旧密码不能为空!");
return false;
}
if (window.document.form1.password.value=="")
{
alert("密码不能为空!");
return false;
}
if (window.document.form1.adminpass.value=="")
{
alert("确认密码不能为空!");
return false;
}
if (window.document.form1.password.value!=window.document.form1.adminpass.value)
{
alert("两次输入的密码不一致!");
return false;
}
if (window.document.form1.adminpurview.value=="")
{
alert("权限不能为空!");
return false;
}
}
</script>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" class="txt1">管理员修改面板(请慎重修改)</td>
</tr>
<tr>
<td align="center" class="txt05">[<a href="admin_AdminMan.asp">返回管理面板</a>]</td>
</tr>
<tr>
<td><form name="form1" method="post" action="" onsubmit="return checkform();">
<table width="98%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#f5f8f5">
<tr>
<td width="46%" align="right" class="txt05"><strong>帐号:</strong><br>
管理员登录帐号,不能小于6而大于20</td>
<td width="54%"><input name="adminname" type="text" class="but" id="adminname" value="<%=rsmod("adminname")%>" maxlength="20">
<input name="oldadminname" type="hidden" id="oldadminname" value="<%=rsmod("adminname")%>">
<input name="adminid" type="hidden" id="adminid" value="<%=rsmod("adminid")%>"></td>
</tr>
<tr>
<td align="right" class="txt05"><strong>旧密码:</strong><br>
请输入你以前的密码</td>
<td><input name="oldpass" type="password" class="but" id="oldpass" maxlength="50"></td>
</tr>
<tr>
<td align="right" class="txt05"><strong>新密码:</strong><br>
管理员登录密码,不能小于6而大于50</td>
<td><input name="password" type="password" class="but" id="password" maxlength="50"></td>
</tr>
<tr>
<td align="right" class="txt05"><strong>确认新密码:</strong><br>
请将你的密码再输入一遍</td>
<td><input name="adminpass" type="password" class="but" id="adminpass" maxlength="50"></td>
</tr>
<tr>
<td align="right" class="txt05"><strong>权限:</strong><br>
管理员所具有的权限</td>
<td><select name="adminpurview" class="but" id="adminpurview">
<option value="" <%If (Not isNull(rsmod("adminpurview"))) Then If ("" = CStr(rsmod("adminpurview"))) Then Response.Write("SELECTED") : Response.Write("")%>>请选择管理员权限</option>
<option value="1" <%If (Not isNull(rsmod("adminpurview"))) Then If ("1" = CStr(rsmod("adminpurview"))) Then Response.Write("SELECTED") : Response.Write("")%>>特级管理员</option>
<option value="2" <%If (Not isNull(rsmod("adminpurview"))) Then If ("2" = CStr(rsmod("adminpurview"))) Then Response.Write("SELECTED") : Response.Write("")%>>高级管理员</option>
<option value="3" <%If (Not isNull(rsmod("adminpurview"))) Then If ("3" = CStr(rsmod("adminpurview"))) Then Response.Write("SELECTED") : Response.Write("")%>>大类管理员</option>
<option value="4" <%If (Not isNull(rsmod("adminpurview"))) Then If ("4" = CStr(rsmod("adminpurview"))) Then Response.Write("SELECTED") : Response.Write("")%>>小类管理员</option>
<option value="5" <%If (Not isNull(rsmod("adminpurview"))) Then If ("5" = CStr(rsmod("adminpurview"))) Then Response.Write("SELECTED") : Response.Write("")%>>文章管理员</option>
</select></td>
</tr>
<tr align="center">
<td colspan="2"><input name="Submit" type="submit" class="but" value="修改">
<input name="adminmod" type="hidden" id="adminmod" value="mod"></td>
</tr>
</table>
</form></td>
</tr>
<tr>
<td><table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="txt03"><strong>管理员权限说明:</strong><br>
<strong>特级管理员:</strong>拥有一切权限;<br>
<strong>高级管理员:</strong>除了管理员的管理外,拥有管理其它的一切权限;
<br>
<strong>大类管理员:</strong>可对文章大类、小类进行管理,可以管理BBS,友情链接等;
<br>
<strong>小类管理员:</strong>可以对小类文章进行管理;
<br>
<strong>文章管理员:</strong>可以审核文章,BBS,友情链接等。</td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
<%
rsmod.close
set rsmod=nothing
call closeconn()
end if
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -