📄 admin_admin.asp
字号:
<%
'==================================
'=文 件 名:admin_admin.asp
'=适用版本:游戏天府WAP网站管理系统(CMS)V1.1
'=官方版权:http://www.gotf.cn
'=文件功能:管理员系统管理
'=文件作者:游戏天府
'=发行时间:2007-02-01
'==================================
%>
<!--#include file="wapls_admin_conn.asp"-->
<!--#include file="wapls_md5.asp"-->
<!--#include file="wapls_admin_top.asp"-->
<%
if session("wapls_adminlogin")<>wapls_sessionvar then
errmsg="您没有登陆或不是管理员。请登陆。"
response.write "<script>window.alert('"&errmsg&"');window.location='admin_login.asp';</script>"
response.End
end if
dim nickname,oldpwd,adminpwd,confirm,adminname,admin_id
if cur_adminsuper<>1 then
'==================================
'=过 程 名:普管与超管的权限分配
'=功 能:普管只能编辑自己的登录密码
'==================================
if request.form("editselfadmin")="true" then
adminname=checksql("管理员名称",request.form("adminname"),1,20)
nickname=checksql("管理员昵称",request.form("nickname"),1,20)
oldpwd=md5(checksql("旧密码",request.form("oldpwd"),1,12))
if len(trim(request.form("adminpwd")))<6 then
Response.Write " <script> window.alert('管理员密码不能少于8位'); history.back();</script>"
Response.End
end if
adminpwd=checksql("新密码",request.form("adminpwd"),1,12)
confirm=checksql("确认密码",request.form("confirm"),1,12)
if adminpwd<>confirm then
Response.Write " <script> window.alert('新密码和确认码不相同,请重新输入'); history.back();</script>"
Response.End
end if
sql="select * from wapls_admin where admin_name='"&adminname&"'"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
if oldpwd<>rs("admin_password") then
rs.close
set rs=nothing
Response.Write " <script> window.alert('管理员密码错误!'); history.back();</script>"
Response.End
else
rs("admin_password")=md5(adminpwd)
rs("nickname")=nickname
rs.update
rs.close
set rs=nothing
Response.Write " <script> window.alert('管理员密码修改成功,请退出重新登录!'); location.href='wapls_checklogin.asp?action=logout&name="&cur_adminname&"'</script>"
Response.End
end if
end if
sql="select * from wapls_admin where admin_name='"&cur_adminname&"'"
set rs2=server.createobject("adodb.recordset")
rs2.open sql,conn,1,1
if cur_adminsuper=1 or rs2("admin_super")=1 then
response.write "<script>window.alert('新密码启用!请重新登录!');window.location='admin_login.asp';</script>"
response.end
end if
%>
<table cellspacing="1" cellpadding="4" class="tableborder" align="center">
<form name="form1" method="post" action="">
<tr>
<td class="td_title">修改管理员〖<span class="current_font"><%=cur_adminname%></span>〗密码</td>
</tr>
<tr class="tablebody" align="center">
<td style="line-height:150%">
名 称:<input type="text" name="" style="width:150px;height:20px;" disabled maxlength="20" value="<%=cur_adminname%>" title="注意:普管不能修改管理员名称!">
<input type="hidden" name="adminname" value="<%=cur_adminname%>"><br>
昵 称:<input type="text" name="nickname" style="width:150px;height:20px;" maxlength="20" value="<%=cur_nickname%>" title="注意:昵称应与管理员名称不同!"><br>
旧 密 码:<input type="password" name="oldpwd" style="width:150px;height:20px;" maxlength="20"><br>
新 密 码:<input type="password" name="adminpwd" style="width:150px;height:20px;" value="" maxlength="20"><br>
确认密码:<input type="password" name="confirm" style="width:150px;height:20px;" value="" maxlength="20"><br>
<span class="current_font">[ 注意:管理员密码最少8位,最长12位 ]</font>
</td>
</tr>
<tr class="tablebody">
<td height="30" align="center">
<input type="submit" name="Submit" value="确定修改">
<input type="reset" name="Reset" value="清空重填">
<input type="hidden" name="editselfadmin" value="true">
</td>
</tr>
</form>
</table>
<%
rs2.close
set rs2=nothing
'==================================
'=功 能:以下为超管权限
'==================================
elseif cur_adminsuper=1 then
%>
<table cellspacing="1" cellpadding="4" class="tableborder" align="center">
<tr align="center">
<td class="td_title" width="34%"><a href="admin_admin.asp?action=modpass"><font color="#ffffff">修改管理员密码</font></a></td>
<td class="td_title" width="33%"><a href="admin_admin.asp?action=addadmin"><font color="#ffffff">添加管理员</font></a></td>
<td class="td_title" width="33%"><a href="admin_admin.asp?action=admingroup"><font color="#ffffff">管理员组</font></a></td>
</tr>
</table>
<br>
<%
'==================================
'=功 能:主调代码,相应功能皆有说明
'==================================
Select case request.QueryString("action")
case "modpass" '修改管理员密码
call modpass()
case "admingroup" '管理员组
call admingroup()
case "addadmin" '添加管理员
call addadmin()
case "editadmin" '编辑管理员
call editadmin()
case "deladmin" '删除管理员
call deladmin()
case else
call admingroup()
End Select
'==================================
'=过 程 名:modpass
'=功 能:修改管理员密码
'==================================
sub modpass()
if request.form("modpass")="true" then
adminname=checksql("",request.form("adminname"),1,20)
nickname=checksql("",request.form("nickname"),1,20)
oldpwd=md5(checksql("",request.form("oldpwd"),1,12))
if len(trim(request.form("adminpwd")))<8 then
Response.Write " <script> window.alert('管理员密码不能少于8位'); history.back();</script>"
Response.End
end if
adminpwd=checksql("新密码",request.form("adminpwd"),1,12)
confirm=checksql("确认码",request.form("confirm"),1,12)
if adminpwd<>confirm then
Response.Write " <script> window.alert('新密码和确认码不相同,请重新输入'); history.back();</script>"
Response.End
end if
sql="select * from wapls_admin where admin_name='"&adminname&"' and admin_password='"&oldpwd&"'"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
if rs.eof then
Response.Write " <script> window.alert('管理员名称或密码错误!'); history.back();</script>"
Response.End
else
rs("admin_password")=md5(adminpwd)
rs("nickname")=nickname
rs.update
Response.Write " <script> window.alert('管理员密码修改成功,请退出重新登录!'); location.href='wapls_checklogin.asp?action=logout&name="&cur_adminname&"'</script>"
Response.End
end if
rs.close:set rs=nothing
end if
%>
<table cellspacing="1" cellpadding="4" class="tableborder" align="center">
<form name="form1" method="post" action="">
<tr>
<td class="td_title">修改管理员[<%=cur_adminname%>]密码</td>
</tr>
<tr class="tablebody" align="center">
<td style="line-height:250%">名 称:<input type="text" name="" value="<%=cur_adminname%>" style="width:150px;height:20px;" maxlength="20" disabled>
<input type="hidden" name="adminname" value="<%=cur_adminname%>"><br>
昵 称:<input type="text" name="nickname" style="width:150px;height:20px;" maxlength="20" value="<%=cur_nickname%>" title="注意:昵称应与管理员名称不同!"><br>
密 码:<input type="password" name="oldpwd" style="width:150px;height:20px;" maxlength="20"><br>
新 密 码:<input type="password" name="adminpwd" style="width:150px;height:20px;" maxlength="20"><br>
确 认 码:<input type="password" name="confirm" style="width:150px;height:20px;" maxlength="20"><br>
<span class="current_font">[ 注意:管理员密码最少8位,最长12位 ]</font>
</td>
</tr>
<tr class="tablebody">
<td height="40" align="center"><input type="submit" name="Submit" value="确定修改"> <input type="reset" name="Reset" value="清空重写"></td>
</tr>
<input type="hidden" name="modpass" value="true">
</form>
</table>
<%
end sub
'==================================
'=过 程 名:addadmin
'=功 能:添加管理员
'==================================
sub addadmin()
if cur_adminsuper<>1 then
errmsg=""&cur_adminname&",您不是超级管理员,没有权限进行此操作!"
response.write "<script>window.alert('"&errmsg&"');window.location='javascript:history.go(-1);';</script>"
response.End
else
if request.form("addadmin")="true" then
adminname=checksql("",request.form("adminname"),1,20)
nickname=checksql("",request.form("nickname"),1,20)
if len(trim(request.form("adminpwd")))<8 then
Response.Write " <script> window.alert('管理员密码不能少于8位'); history.back();</script>"
Response.End
end if
adminpwd=checksql("新密码",request.form("adminpwd"),1,12)
confirm=checksql("确认码",request.form("confirm"),1,12)
if adminpwd<>confirm then
Response.Write " <script> window.alert('新密码和确认码不相同,请重新输入'); history.back();</script>"
Response.End
end if
if adminpwd<>confirm then
Response.Write " <script> window.alert('新密码和确认码不相同,请重新输入'); history.back();</script>"
Response.End
end if
sql="select * from wapls_admin"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
rs.addnew
rs("admin_name")=adminname
rs("nickname")=nickname
rs("admin_password")=md5(adminpwd)
rs.update
rs.close
set rs=nothing
response.redirect "admin_admin.asp"
end if
end if
%>
<table cellspacing="1" cellpadding="4" class="tableborder" align="center">
<form name="form2" method="post" action="">
<tr>
<td class="td_title">添加新的管理员</td>
</tr>
<tr class="tablebody">
<td align="center" style="line-height:150%">管理员名称:<input type="text" name="adminname" style="width:150px;height:20px;" maxlength="20"><br>
管理员昵称:<input type="text" name="nickname" style="width:150px;height:20px;" maxlength="20" title="注意:昵称应与管理员名称不同!"><br>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -