<!--#include file="admin_cook.asp"-->
<!--#include file="../conn.asp"-->
<!--#include file="admin_checkes.asp"-->
<!--#include file="inc/md5.asp"-->
<!--#include file="inc/Function.asp"-->
<HTML>
<HEAD>
<TITLE>管理员管理 - 管理页面</TITLE>
<LINK href="images/Style.css" type="text/css" rel="stylesheet">
<META content="MSHTML 6.00.2900.5512" name="GENERATOR">
</HEAD>
<BODY bottomMargin=0 leftMargin=0 topMargin=0 rightMargin=0>
<BR style="OVERFLOW: hidden; LINE-HEIGHT: 3px">
<TABLE class="tableBorder" cellSpacing=1 cellPadding=2 align="center" border=0>
<TBODY>
<TR>
<TH>管理员管理</TH></TR>
<TR height=25>
<TD class="TableRow1" align="left"><B>操作说明：</B>
<BR>①、你可以任意增加管理员管理,然后此做相应的操作. 
</TD></TR>
<TR height=25>
<TD class="TableRow1" align="left"><B>管理员管理导航：</B> 
<A href="?act=list">管理员管理首页</A> | 
<A class="showmeun" href="?act=add">添加管理员</A>
</TD>
</TR>
</TBODY>
</TABLE>
<BR>
<%
action=request("act")
select case action
case "del":
call del()
case "add":
call add()
case "addok"
call addok()
case "edit":
call edit()
case "editok":
call editok()
case "list":
call list()
end select
sub add()
%>
<TABLE width="243" border=0 align="center" cellPadding=3 cellSpacing=1 class="tableBorder">
<FORM name="form" action="?act=addok" method="post">
<TBODY>
<TR>
<TH colSpan=2>添加管理员</TH></TR>
<TR>
<TD class="TableRow1" align="right" width="40%">管理员名称：</TD>
<TD class="TableRow1" align="left" width="60%">
<input name="txqname" type="text" size="20">
</TD>
</TR>
<TR>
<TD class="TableRow1" align="right" width="40%">管理员密码：</TD>
<TD class="TableRow1" align="left" width="60%">
<input name="txqpass" type="password" size="20">
</TD>
</TR>
<TR>
<TD class="TableRow1" align="right" width="40%">确 认 密 码：</TD>
<TD class="TableRow1" align="left" width="60%">
<input name="txqpasss" type="password" size="20">
</TD>
</TR>
<TR>
<TD class="TableRow2" align="middle" colSpan=2>
<INPUT class="button" type="submit" value=" 添 加 " name="Submit">
<INPUT class="button" type="reset" value=" 重 填 " name="Submit2">
</TD>
</TR>
</FORM>
</TBODY>
</TABLE>
<%
end sub
sub addok()
dim rs2,sql2
txqname=Trim(request("txqname"))
txqpass=Trim(request("txqpass"))
txqpasss=Trim(request("txqpasss"))
set rs2=Server.CreateObject("ADODB.RecordSet")
sql2="select * from admin where txqname='"&txqname&"'"
rs2.Open sql2,conn,1,1
if not (rs2.eof and rs2.BOF) then
txqname=rs2("txqname")
Response.Write("<script language=javascript>alert('你填写管理员名称已经存在\请重新填写');history.back(1);</script>")
Response.End
end if
if request.Form("txqname")="" then
Response.Write("<script language=javascript>alert('你必须填写管理员名称');history.back(1);</script>")
Response.End
end if
if request.Form("txqname")="txqname" then
Response.Write("<script language=javascript>alert('你填写管理员名称已经存在\请重新填写');history.back(1);</script>")
Response.End
end if
if request.Form("txqpass")="" then
Response.Write("<script language=javascript>alert('你必须填写管理员密码');history.back(1);</script>")
Response.End
end if
if request.Form("txqpasss")="" then
Response.Write("<script language=javascript>alert('你必须填写确认密码');history.back(1);</script>")
Response.End
end if
if request.Form("txqpass")<>request.Form("txqpasss") then
Response.Write("<script language=javascript>alert('你的确认密码和管理员密码不一致\n请重新填写');history.back(1);</script>")
Response.End
end if
rs2.Close
set rs2=nothing
dim rs3,sql3
set rs3=Server.CreateObject("ADODB.Recordset")
rs3.Open "select * from admin",conn,1,3
txqname=Request.Form("txqname")
txqpass=Request.Form("txqpass")
rs3.AddNew
rs3("txqname")=txqname
rs3("txqpass")=md5(txqpass)
rs3.Update
rs3.Close
set rs3=nothing
Succeed("<li>添加成功</li>")
end sub
sub list()
%>
<TABLE class="tableBorder" cellSpacing=1 cellPadding=3 align="center" border=0>
<TBODY>
<TR>
<TH width="10%">编号</TH>
<TH width="30%">管理员名称</TH>
<TH width="40%">管理员密码</TH>
<TH noWrap width="20%">操作选项</TH>
</TR>
<%
dim rs4,sql4
set rs4=Server.CreateObject("ADODB.RecordSet")
sql4="select * from admin"
rs4.Open sql4,conn,1,1
if rs4.EOF and rs4.BOF then
%>
<TR>
<TD colspan="4" align="middle" class="TableRow2">
当前还没有管理员
</TD>
</TR>
<%
end if
do while not rs4.EOF
%>
<FORM name=delform action="?act=del&id=<%=rs4("id")%>" method="post">
<TR>
<TD class="TableRow2" align="center"><%=rs4("id")%></TD>
<TD class="TableRow2" align="center"><%=rs4("txqname")%></TD>
<TD class="TableRow2" align="center"><%if rs4("txqpass")=rs4("txqpass") then response.write"☆★☆★☆★☆★"%></TD>
<TD class="TableRow2" align="middle">
<INPUT class="button" onClick="return confirm('您确定要删除选定的吗?');" type="submit" value="删除" name="Submit2"> 
<INPUT class="button" onClick="javascript:location.href='?act=edit&id=<%=rs4("id")%>'" type="button" value="修改" name="Submit1">
</TD>
</TR>
</form>
<%
rs4.MoveNext
loop
rs4.Close
set rs4=nothing
end sub
sub del()
dim sql5
sql5="delete from admin where id="&request.QueryString("id")
conn.Execute(sql5)
conn.Close
set conn=nothing
Succeed("<li>删除成功</li>")
end sub
sub edit()
dim rs6,sql6
set rs6=Server.CreateObject("ADODB.RecordSet")
sql6="select * from admin where id="&request.QueryString("id")
rs6.Open sql6,conn,1,1
%>
<TABLE class="tableBorder" cellSpacing=1 cellPadding=3 align="center" border=0>
<FORM name="form" action="?act=editok&id=<%=rs6("id")%>" method="post">
<TBODY>
<TR>
<TH colSpan=2>修改管理员密码</TH></TR>
<TR>
<TD class="TableRow1" align="right" width="30%">您的管理员名称：</TD>
<TD class="TableRow1" align="left" width="70%">
<input name="txqname" type="text" size="20" value="<%=rs6("txqname")%>" disabled> *管理员名称不可更改
</TD>
</TR>
<TR>
<TD class="TableRow1" align="right" width="30%">新的管理员密码：</TD>
<TD class="TableRow1" align="left" width="70%">
<input name="txqpass" type="password" size="20"> *
</TD>
</TR>
<TR>
<TD class="TableRow1" align="right" width="30%">确认管理员密码：</TD>
<TD class="TableRow1" align="left" width="70%">
<input name="txqpasss" type="password" size="20"> *
</TD>
</TR>
<TR>
<TD class="TableRow2" align="middle" colSpan=2>
<INPUT class="button" type="submit" value=" 修 改 " name="Submit">
<INPUT class="button" type="reset" value=" 重 填 " name="Submit2">
</TD>
</TR>
</FORM>
</TBODY>
</TABLE>
<%
end sub
sub editok()
dim rs7,sql7
txqpass=Trim(request("txqpass"))
txqpasss=Trim(request("txqpasss"))
set rs7=Server.CreateObject("ADODB.RecordSet")
sql7="select * from admin where txqpass='"&txqpass&"'"
rs7.Open sql7,conn,1,1
if request.Form("txqpass")="" then
Response.Write("<script language=javascript>alert('你必须输入新的管理员密码');history.back(1);</script>")
Response.End
end if
if request.Form("txqpasss")="" then
Response.Write("<script language=javascript>alert('你必须输入新的管理员密码');history.back(1);</script>")
Response.End
end if
if request.Form("txqpass")<>request.Form("txqpasss") then
Response.Write("<script language=javascript>alert('你两次输入的管理员密码不相同');history.back(1);</script>")
Response.End
end if
rs7.close
set rs7=nothing
dim rs8,sql8
set rs8=Server.CreateObject("ADODB.RecordSet")
sql8="select * from admin"
rs8.Open sql8,conn,1,3
rs8("txqpass")=md5(txqpass)
rs8.Update
rs8.Close
set rs8=nothing
Response.Write("<script language=javascript>alert('修改成功！');history.back(1);</script>")
Response.write"admin_Pass.asp?act=list"
Response.End
end sub
%>
</BODY>
</HTML>
