<%
'程序名称：千纸鹤网站管理系统
'程序作者：千纸鹤
'作者邮箱：qzhxxw@sina.com
'作者 Q Q：138999501
'作者电话：0000000000
'官方主页：http://www.qqzzhh.com/
'官方论坛：http://www.qqzzhh.com/bbs
%>
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/set.asp"-->
<!--#include file="inc/dll.asp"-->
<!--#include file="inc/md5.asp"-->
<%
call hacker()
if session("superlogin")<>yecao then
response.Write "<script>alert('您还没有登陆！');this.location.href='index.asp';</script>"
Response.End
elseif session("superadmin")<>"admin" then
response.Write "<script>alert('您不是超级管理员！您的权限不足！');this.location.href='index.asp';</script>"
Response.End
end if
%>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="STYLESHEET" type="text/css" href="img/admin.css">
<script src=img/adminjs.js></script>
</head><br><br>
<%
select case request("action")
case ""
call admin()
case "editadmin"
call editadmin()
case "editadminok"
admin_name=request.Form("admin_name")
admin_super=request.Form("admin_super")
admin_user=request.Form("admin_user")
if MD5(trim(replace(request("admin_pass"),"'","")))<>MD5(trim(replace(request("admin_pass_pass"),"'",""))) then
Response.Write("<script language=javascript>alert('密码和确认密码不同！请从新输入！');history.go(-1);</script>")
end if 
set rs=server.CreateObject("adodb.recordset")
sql="select * from YC_admin where id="&request("id")
rs.open sql,conn,1,3
rs("admin_name")=admin_name
rs("admin_pass")=MD5(trim(replace(request("admin_pass"),"'","")))
rs("admin_super")=admin_super
rs("admin_user")=admin_user
rs.update
rs.close
response.Redirect"admin_admin.asp"
case "newadmin"
call newadmin()
case "newadminok"
admin_name=request.Form("admin_name")
admin_super=request.Form("admin_super")
admin_pass=MD5(trim(replace(request("admin_pass"),"'","")))
admin_pass_pass=MD5(trim(replace(request("admin_pass_pass"),"'","")))
admin_user=request.Form("admin_user")
if admin_pass<>admin_pass_pass then
Response.Write("<script language=javascript>alert('密码和确认密码不同！请从新输入！');history.go(-1);</script>")
end if 
set rs=server.CreateObject("adodb.recordset")
sql="select * from YC_admin"
rs.open sql,conn,1,3
rs.addnew
rs("admin_name")=admin_name
rs("admin_pass")=admin_pass
rs("admin_super")=admin_super
rs("admin_user")=admin_user
rs.update
rs.close
response.Redirect"admin_admin.asp"
case "lock"
Conn.Execute("update YC_admin set admin_lock=true Where id="&Request.QueryString("id"))
Response.Write("<script language=javascript>alert('锁定成功！');this.location.href='admin_admin.asp';</script>")
case "unlock"
Conn.Execute("update YC_admin set admin_lock=false Where id="&Request.QueryString("id"))
Response.Write("<script language=javascript>alert('恢复成功！');this.location.href='admin_admin.asp';</script>")
case "del"
Conn.Execute("Delete * From YC_admin Where id="&Request.QueryString("id"))
Response.Write("<script language=javascript>alert('删除成功！');this.location.href='admin_admin.asp';</script>")
end select
sub admin()
set rs=server.CreateObject("adodb.recordset")
sql="select * from YC_admin order by id desc"
rs.open sql,conn,1,1%>
<table align=center border="0" cellpadding="0" cellspacing="0" bordercolor="<%=border%>" rules=none class=3d>
<tr><td height="22" colspan="8" class=title><b>&nbsp;<img src=img/ie.gif border=0 width=15 height=15 align=absMiddle>&nbsp;管理员管理</b></td></tr>
<tr class=bg height="25">
<td width=100 align=center>管理员名称</td><td width=100 align=center>前台会员名</td>
<td width=100 align=center>管理员权限</td>
<td width=70 align=center>状  态</td>
<td  width=160 align=center>操 作</td>
<tr><td class=hr colspan=8></td></tr>
<%if not rs.bof and not rs.eof then
num=1
do while not rs.eof%>
<tr height="25" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#efefef'">
<td>&nbsp;<img src=img/usertitle.gif align=center border=0>&nbsp;<%=rs("admin_name")%></td>
<td width=100 align=center><%=rs("admin_user")%></td><td align=center>
<%if rs("admin_super")="admin" then
response.write"超级管理员"
elseif rs("admin_super")="news" then
response.write"新闻管理员"
elseif rs("admin_super")="art" then
response.write"文章管理员"
elseif rs("admin_super")="dj" then
response.write"娱乐管理员"
elseif rs("admin_super")="pic" then
response.write"图片管理员"
elseif rs("admin_super")="down" then
response.write"下载管理员"
end if%></td><td width=70 align=center>
<%if rs("admin_lock")=true then
response.write"锁  定"
else
response.write"正  常"
end if%></td>
<td align=center><a href=?action=del&id=<%=rs("id")%>>删除</a>&nbsp;<a href=?action=editadmin&id=<%=rs("id")%>>编辑</a>&nbsp;<%if rs("admin_lock")=true then
response.write"<a href=?action=unlock&id="&rs("id")&">恢复</a>"
else
response.write"<a href=?action=lock&id="&rs("id")&">锁定</a>"
end if%>
</td></tr>
<tr><td class=hr colspan=8></td></tr>
</form>
<%
num=num+1
rs.movenext
loop
end if
rs.close
set rs=nothing
Response.Write("</table>")
end sub
sub newadmin()%>
<script language="javascript">
function chk(){
if(document.form.admin_name.value==""){
alert("管理员名称不能为空！");
document.form.admin_name.focus();
return false;}
if(document.form.admin_pass.value==""){
alert("管理员密码不能为空！");
document.form.admin_pass.focus();
return false;}
if(document.form.admin_pass_pass.value==""){
alert("管理员确认密码不能为空！");
document.form.admin_pass_pass.focus();
return false;}
return true;}
</Script>
<form method="post" name="form" id="form" onsubmit="return chk();" action="?action=newadminok">
<table width="300" align=center border="0" cellpadding="0" cellspacing="0" rules=none class=3d>
<tr class="title"  height="22"><td><b>&nbsp;<img src=img/ie.gif border=0 width=15 height=15 align=absMiddle>&nbsp;添加管理员</b></td></tr>	
<tr class=bg height="25"><td>
&nbsp;管理员名称：<input name="admin_name" type="text" id="admin_name"  class=yecao style="width:170px">
</td></tr>
<tr class=bg height="25"><td>
&nbsp;管理员密码：<input name="admin_pass" type="password" id="admin_pass"  class=yecao style="width:170px">
</td></tr>
<tr class=bg height="25"><td>
&nbsp;请确认密码：<input name="admin_pass_pass" type="password" id="admin_pass_pass"  class=yecao style="width:170px">
</td></tr>
<tr class=bg height="25"><td>
&nbsp;前台会员名：<input name="admin_user" type="text" id="admin_user"  class=yecao style="width:170px">
</td></tr>
<tr class=bg height="25"><td>
&nbsp;管理员权限：<select name="admin_super" class=yecao>
<option value="admin">超级管理员</option>
<option value="news">新闻管理员</option>
<option value="art">文章管理员</option>
<option value="dj">娱乐管理员</option>
<option value="pic">图片管理员</option>
<option value="down">下载管理员</option>
</select>
</td></tr>

<tr><td class="hr"></td></tr>
<tr height="30" class=foot>
<td align="center">
<input name="new" type="submit" class="adminbutton" id="new" value="添 加">&nbsp;
<input name="Submit2" type="reset" class="adminbutton" value="清 空" >
</td></tr>
</table> </form>
<%end sub
sub editadmin()
set rs=server.CreateObject("adodb.recordset")
sql="select * from YC_admin where id="&request("id")
rs.open sql,conn,1,1%>
<script language="javascript">
function chk(){
if(document.form.admin_name.value==""){
alert("管理员名称不能为空！");
document.form.admin_name.focus();
return false;}
return true;}
</Script>
<form method="post" name="form" id="form" onsubmit="return chk();" action="?action=editadminok">
<table width="300" align=center border="0" cellpadding="0" cellspacing="0" rules=none class=3d>
<tr class="title"  height="22"><td><b>&nbsp;<img src=img/ie.gif border=0 width=15 height=15 align=absMiddle>&nbsp;编辑管理员</b></td></tr>	
<tr class=bg height="25"><td>
&nbsp;管理员名称：<input name="admin_name" type="text" id="admin_name"  class=yecao style="width:100px" value=<%=rs("admin_name")%>>
</td></tr>
<tr class=bg height="25"><td>
&nbsp;管理员密码：<input name="admin_pass" type="password" id="admin_pass"  class=yecao style="width:100px">
不修改请留空！
</td></tr>
<tr class=bg height="25"><td>
&nbsp;请确认密码：<input name="admin_pass_pass" type="password" id="admin_pass_pass"  class=yecao style="width:100px">
不修改请留空！
</td></tr>
<tr class=bg height="25"><td>
&nbsp;前台会员名：<input name="admin_user" type="text" id="admin_user"  class=yecao style="width:100px" value=<%=rs("admin_user")%>>
</td></tr>
<tr class=bg height="25"><td>
&nbsp;管理员权限：<select name="admin_super" class=yecao>
<option value="admin" <%if rs("admin_super")="admin" then response.write "selected"%>>超级管理员</option>
<option value="news" <%if rs("admin_super")="news" then response.write "selected"%>>新闻管理员</option>
<option value="art" <%if rs("admin_super")="art" then response.write "selected"%>>文章管理员</option>
<option value="dj" <%if rs("admin_super")="dj" then response.write "selected"%>>娱乐管理员</option>
<option value="pic" <%if rs("admin_super")="pic" then response.write "selected"%>>图片管理员</option>
<option value="down" <%if rs("admin_super")="down" then response.write "selected"%>>下载管理员</option>
</select>
</td></tr>
<tr><td class="hr"></td></tr>
<tr height="30" class=foot>
<td align="center">
<input name="new" type="submit" class="adminbutton" id="new" value="修 改">&nbsp;
<input name="Submit2" type="reset" class="adminbutton" value="清 空" >
<input name="id" type="hidden"  value="<%=rs("id")%>" >
</td></tr>
</table> </form>
<%end sub
call closedata()%>














