www.gusucode.com > 盐城分类信息网asp源码程序 > admin/admin_add.asp

    <!--#include file=conn.asp-->
<!--#include file=cookies.asp-->
<!--#include file=../inc/md5.asp-->
<link href="inc_style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
	background-color: #E7EEF5;
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style><%if request.cookies("admincnmai")("max")<>0 then
dim UserName
UserName=request.cookies("admincnmai")("username")
cnmai=request("cnmai")
password2=trim(request("password2"))
set rs = Server.CreateObject("ADODB.RecordSet")
sql="select * from admin where UserName='"&UserName&"'"
rs.open sql,conn,1,3
if cnmai="editchk1" then
if password2="" then
response.write"<SCRIPT language=JavaScript>alert('请填写新的密码');javascript:history.go(-1)</SCRIPT>"
response.end 
end if
rs("password")=md5(password2)
rs.update
response.write"<SCRIPT language=JavaScript>alert('密码修改成功');</SCRIPT>"
response.write "<meta http-equiv=refresh content=""1;URL=index.asp"">"
response.end
end if
%>
<div align="center">
  <table width="68%" border="1" align="center" cellpadding="3" cellspacing="0" bordercolorlight="#335078" bordercolordark="#FFFFFF" bgcolor="#C5D5E4" style="font-size:12px; letter-spacing:1px;">

<tr bgcolor="#B6EBC4">
<td align="center" height="25" bgcolor="#C5D5E4"><b>修改<%=rs("username")%>(二级管理员)密码</b></td>
</tr>
<tr>
<td height="75" bgcolor="#DFE8F0">
<form method="POST" action="admin_add.asp?cnmai=editchk1" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<p align="center" style="line-height: 200%; ">
新密码:
  <input name="password2" size="20" maxlength="20" type="password"></p>
<p align="center" style="line-height: 200%; ">
<input type="submit" value="确定修改" name="editchk"></p>
</form>
</td>
</tr>
</table>
</div>
<%
else
%>
<div align="center">
<form method="POST" action="admin_addchk.asp">
<center>
  <table width="68%" border="1" align="center" cellpadding="3" cellspacing="0" bordercolorlight="#335078" bordercolordark="#FFFFFF" bgcolor="#C5D5E4" style="font-size:12px; letter-spacing:1px;">

<tr bgcolor="#B6EBC4">
<td bgColor="#C5D5E4" height="25">
<p align="center"><b>增加管理员</b></td>
</tr>
<tr>
<td height="21" align="middle" bgcolor="#DFE8F0" style="BORDER-BOTTOM: medium none"><div align="center"><br>
  用户名:
  <input name="username" size="20" maxlength="20">
</div></td>
</tr>
<tr>
<td height="25" align="middle" bgcolor="#DFE8F0" style="BORDER-TOP: medium none; BORDER-BOTTOM: medium none"><div align="center">密&nbsp; 码:
  <input name="password" size="20" maxlength="20">
</div></td>
</tr>
<tr>
<td height="25" bgcolor="#DFE8F0" style="BORDER-TOP: medium none">
<p align="center">
  <input type="submit" value="确定添加" name="B1"></td>
</tr>
</table>
</center>
</form>
</div>
<div align="center">
<%
dim username2,password2,max
username2=trim(request("username2"))
password2=trim(request("password2"))
max=request("R1")
cnmai=request("cnmai")
id=request("id")
if cnmai="editchk" then
set rs = Server.CreateObject("ADODB.RecordSet")
sql="select * from [admin] where id="&cstr(id)
rs.open sql,conn,1,3
if password2="" then
response.write"<SCRIPT language=JavaScript>alert('请填写新的密码');javascript:history.go(-1)</SCRIPT>"
response.end 
end if
rs("username")=username2
rs("password")=md5(password2)
rs("max")=max
rs.update
response.write"<SCRIPT language=JavaScript>alert('修改成功');</SCRIPT>"
response.write "<meta http-equiv=refresh content=""1;URL=admin_add.asp"">"
response.end
end if
if cnmai="del" then
call del()
else
 if cnmai="edit" then
 call edit()
 else
%>
</div>
<div align="center">
<center>
  <table width="68%" border="1" align="center" cellpadding="3" cellspacing="0" bordercolorlight="#335078" bordercolordark="#FFFFFF" bgcolor="#C5D5E4" style="font-size:12px; letter-spacing:1px;">

<tr bgcolor="#B6EBC4">
<td width="46" height="24" align="center" bgcolor="#C5D5E4"><font color="#990000">编号</font></td>
<td width="221" height="24" align="center" bgcolor="#C5D5E4"><font color="#990000">管理帐号</font></td>
<td width="65" height="24" align="center" bgcolor="#C5D5E4"><font color="#990000">操作</font></td>
<td width="65" height="24" align="center" bgcolor="#C5D5E4"><font color="#990000">修改</font></td>
</tr>
<%
dim rs,sql,i,id,cnmai
i=1
set rs = Server.CreateObject("ADODB.RecordSet")
sql="select id,username from [admin]" 
rs.open sql,conn,1,1
do while not rs.eof
%>
<tr>
<td width="46" height="24" align="center" bgcolor="#E0E9F1"><%=i%></td>
<td width="221" height="24" align="center" bgcolor="#E0E9F1"><%=rs("username")%></td>
<td width="65" height="24" align="center" bgcolor="#E0E9F1"><a href="?cnmai=del&id=<%=rs("id")%>">删除</a></td>
<td width="65" height="24" align="center" bgcolor="#E0E9F1">
<a href="?cnmai=edit&id=<%=rs("id")%>">修改</a></td>
</tr>
<%
i=i+1
rs.movenext
loop
rs.close
set rs=nothing
sub del()
id=request("id")
set rs = Server.CreateObject("ADODB.RecordSet")
sql="delete from [admin] where id="&cstr(id)
rs.open sql,conn,1,3
response.write "<font size=2>帐号删除成功!</font><br>"
response.end
end sub
%>
</table>
<%sub edit()
id=request("id")
set rs = Server.CreateObject("ADODB.RecordSet")
sql="select * from [admin] where id="&cstr(id)
rs.open sql,conn,1,3
%>
  <table width="68%" border="1" align="center" cellpadding="3" cellspacing="0" bordercolorlight="#335078" bordercolordark="#FFFFFF" bgcolor="#C5D5E4" style="font-size:12px; letter-spacing:1px;">

<tr bgcolor="#B6EBC4"><td align="center" height="25" bgcolor="#C5D5E4"><b>修改管理员信息</b></td>
</tr>
<tr>
<td height="75" bgcolor="#EBF0F5">
<form method="POST" action="admin_add.asp?cnmai=editchk&id=<%=id%>" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<p align="center" style="line-height: 200%; margin-top: 0; margin-bottom: 0">用户名:
  <input name="username2" size="20" maxlength="20" value="<%=rs("username")%>"></p>
<p align="center" style="line-height: 200%; margin-top: 0; margin-bottom: 0">
密&nbsp; 码:
<input name="password2" size="20" maxlength="20" type="password"></p>
<p align="center" style="line-height: 200%; margin-top: 0; margin-bottom: 0">
<input type="radio" value="1"<%if rs("max")=1 then %> checked <%end if%> name="R1">特级管理员 <input type="radio" value="0" <%if rs("max")=0 then %> checked <%end if%> name="R1">二级管理员</p>
<p align="center" style="line-height: 200%; margin-top: 0; margin-bottom: 0">
<input type="submit" value="确定修改" name="editchk"></p>
</form>
</td>
</tr>
</table>
<%
end sub
end if
end if
set rs=nothing
closedb%>
</center>
</div>
<%end if%>