<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
'****************************************************************
'**   版权所有：烈火工作室  演示网站http://www.strongfire.cn   **
'**   QQ:839225572   邮箱：strongfire2008@163.com              **
'**   非正版用户不得擅自非法修改用于商业用途！查出必究。       **
'****************************************************************
%>
<!--#include file="islogin.asp"-->
<!--#include file="Check_SqlIn.asp"-->
<!--#include file="admin_conn.asp"-->
<!--#include file="md5.asp"-->
<%
act=Request("act")
id=Request("id")
user=Request("user")
password=Request("password")

if act="add" then
	if (user<>"" and password<>"") then
		Set rs=Server.CreateObject("Adodb.RecordSet")
		sql="Select * From admin Where user='"&user&"'"
		rs.open sql,conn,1,3
		if not rs.eof then
			response.Write "<script language=javascript>alert( '用户名已存在！'  );location.href = 'javascript:history.back()'</script>"
		else
			rs.addnew
			rs("user")=user
			rs("password")=md5(password)
			rs.update
		end if
		rs.close
		set rs=nothing
	end if
end if

if act="del" then
	conn.execute("delete from admin where ID="&ID)
end if
if act="modify" then
	sql="update Admin set password='" & md5(Password) & "' where id=" & id
	conn.execute(sql)
end if

%>
<html>
<head>
<LINK href="admin_css.css" type=text/css rel=stylesheet>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>修改信息列表</title>
<script language="JavaScript" type="text/javascript">
function check_input()  
{  
	if (form1.user.value==""){
		alert ("\n请填写用户名！");
		document.form1.user.focus();
		return false;
	}
	if (form1.password.value==""){
		alert ("\n请填写密码！");
		document.form1.password.focus();
		return false;
	}
		return true;
}
</script>
<style type="text/css">
<!--
.STYLE1 {
	font-size: 14px;
	color: #0000FF;
	font-weight: bold;
}
.textstype {
	height: 20px;
	width: 100%;
	border-top-style: none;
	border-right-style: none;
	border-bottom-style: none;
	border-left-style: none;
}
-->
</style>
</head>


<body>
<div align="center">
  <p>&nbsp;</p>
  <table width="361" border=0 align=center cellspacing=1 class="list1">
    <tr>
      <th colspan="4" >管理员列表</th>
    </tr>
    <tr>
      <td width="34" ><div align="center">ID号</div></td>
      <td width="120" ><div align="center">用户名</div></td>
      <td width="82" ><div align="center">修改</div></td>
      <td width="83" ><div align="center">删除</div></td>
    </tr>
	
	<%
	Set rs=Server.CreateObject("ADODB.RecordSet") 
	sql="select * from admin order by id desc"
	rs.Open sql,conn,1,1
	do while not rs.eof
	%>
    <tr>
      <td width="34" ><div align="center"><%=rs("id")%></div></td>
      <td ><div align="center"><%=rs("user")%></div></td>
      <td width="82" ><div align="center"><a href="SuperUserModify.asp?id=<%=rs("id")%>">修改密码</a></div></td>
      <td width="83" ><div align="center"><a href="SuperUser.asp?id=<%=rs("id")%>&act=del" onClick="return confirm('确定要删除吗？')">删除</a></div></td>
    </tr>
	<%
	rs.movenext 
	loop
	rs.close
	set rs=nothing
	%>	
  </table>
  
  <p>&nbsp;</p>
  <form name="form1" method="post" onSubmit="return check_input()" action="SuperUser.asp?act=add">
  
  <table  width="207" border=0 align=center cellspacing=1 class="list1">
    <tr>
      <td colspan="2" ><div align="center">添加用户</div>        <div align="center"></div></td>
    </tr>
   
    <tr>
      <td width="49" ><div align="center">用户名：</div></td>
      <td width="136">
        <div align="center">
          <input name="user" type="text"  id="user" size="20">
        </div></td>
    </tr>
    <tr>
      <td ><div align="center">密&nbsp; 码：</div></td>
      <td >
        <div align="center">
          <input name="password" type="text"  id="password" size="20">
          </div></td>
    </tr>
    <tr>
      <td colspan="2" ><div align="center">
        <label>
        <input type="submit" name="Submit" value="提交">
        </label>
        <label>
         &nbsp;
         <input type="reset" name="Submit2" value="重置">
        </label>
      </div>        <div align="center"></div></td>
    </tr>
  </table>
  </form>
  <p>&nbsp;</p>
  <p><br>
  </p>
</div>
</body>

</html>
