<%@LANGUAGE="VBSCRIPT" %>
<!--#include file = "dean_pri.asp"-->
<!--#include file="../connadmin.asp"-->
<!--#include file = "../md5.asp"-->

<script language="javascript">
<!--
function checkdel(username){
	if (confirm("您确定要删除 "+username+" 这个超级用户吗？")){
		window.open("dean_pri_chpass.asp?act=del&username="+username,"_self");
	}
	else{
		//Do Nothing;
	}
}
-->
</script><%
doact=request("act")
rmyname=trim(request.form("textfield"))
rmypass=trim(request.form("textfield2"))
rmycaption=trim(request.form("textfieldid"))
bmyname=trim(request.form("textfield3"))
bmypasso=trim(request.form("textfield5"))
bmypass=trim(request.form("textfield4"))
bmycaption=trim(request.form("textfield6"))
if doact="add" then
if rmyname="" or rmypass="" or rmycaption="" then
  response.write("<center><font color=red>用户名、密码、身份标志不能为空！</font></center>")
else
  set rs=conn.execute("select deanno from deandata where deanno='"&rmyname&"'") 
  if rs.eof then
  strCommand = "INSERT INTO deandata (deanno,deanpass,deanname) VALUES ('"&rmyname&"','"&md5(rmypass)&"','"&rmycaption&"')"
  conn.Execute strCommand 
  response.write("<center><font color=red>添加新帐户成功！</font></center>")
  else
  response.write("<center><font color=red>错误!此用户名已存在,请重新操作</font></center>")
  end if 
  rs.close
end if
end if

if doact="modi" then
set rs=conn.execute("select deanno from deandata where deanno='"&bmyname&"' and deanpass='"&md5(bmypasso)&"'") 
  if not rs.eof then
      if bmycaption="" then
		  conn.Execute("UPDATE deandata SET deanpass='"&md5(bmypass)&"' WHERE deanno='"&bmyname&"'")
	  else
		  conn.Execute("UPDATE deandata SET deanpass='"&md5(bmypass)&"',deanname='"&bmycaption&"' WHERE deanno='"&bmyname&"'")
	  end if
  response.write("<center><font color=red>修改成功！</font></center>")

  else
  response.write("<center><font color=red>错误!此用户名不存在!或你的旧密码输入错误</font></center>")
  end if
end if

if doact="del" then
delusername = trim(Request.QueryString("username"))
conn.Execute("DELETE FROM deandata WHERE deanno='"&delusername&"'")
end if
%>
<html>
<head>
<LINK href="../img/css.css" type=text/css rel=stylesheet>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<style type=text/css>
body  {
SCROLLBAR-FACE-COLOR: #9CC5D7;
SCROLLBAR-HIGHLIGHT-COLOR: #ffffff; 
SCROLLBAR-SHADOW-COLOR: #006699; 
SCROLLBAR-3DLIGHT-COLOR: #006699; 
SCROLLBAR-ARROW-COLOR: #330000; 
SCROLLBAR-TRACK-COLOR: #E2F3F1; 
SCROLLBAR-DARKSHADOW-COLOR: #ffffff;}
.style6 {	color: #FFFFFF;
	font-weight: bold;
}
.style7 {color: #FFFFFF}
</style>
</head>

<body><center>
  <table class="border" width="98%" border="0" align="center" cellpadding="1" cellspacing="0">
    <tr> 
      <td height="534" align="center" valign="top" class="bg_low"> 
        <table width="100%" height="39" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td height="39" align="center" valign="middle" class="bgtop"><table width="788" height="14" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td width="338"><font color="#FFFFFF">您的身份：<%=Session("deanname")%></font></td>
                <td width="450"><font color="#FFFFFF"><b> <a href="dean_book.asp"><span class="style6">留言管理</span></a></b></font><span class="style7"><strong> | </strong></span><a href="dean_pri_chpass.asp"><span class="style6">修改密码</span></a><span class="style7"><strong> |</strong></span> <a href="dean_logout.asp"><span class="style6">退出</span></a> </td>
              </tr>
            </table>              </td>
          </tr>
        </table>
        <center><table width="400" border="5" cellpadding="0" cellspacing="0" bordercolor="#ABCEDD">
            <tr> 
              <td align="center">
<form name="form2" method="post" action="dean_pri_chpass.asp?act=modi">
                  <p>&nbsp; </p>
                  <table width="247" height="84" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td width="55">用户名</td>
                      <td width="168"><input type="text" name="textfield3" value="<%=Session("deanno")%>"></td>
                      <td width="24">&nbsp;</td>
                    </tr>
                    <tr>
                      <td>旧密码</td>
                      <td><input type="text" name="textfield5"></td>
                      <td>&nbsp;</td>
                    </tr>
                    <tr>
                      <td>新密码</td>
                      <td><input type="text" name="textfield4"></td>
                      <td>&nbsp;</td>
                    </tr>
                    <tr>
                      <td>身 份:</td>
                      <td><input name="textfield6" type="text" id="textfield6" value="<%=Session("deanname")%>"></td>
                      <td>&nbsp;</td>
                    </tr>
                    <tr>
                      <td>&nbsp;</td>
                      <td><input type="submit" name="Submit3" value="提交">
                        <input name="reset" type="reset" id="reset" value="重置"></td>
                      <td>&nbsp;</td>
                    </tr>
                  </table>
                </form></td>
            </tr>
          </table>
          <br>
        </center>
        
      </td>
    </tr>
  </table>
  <br>
</center>
</body>
</html>
<%conn.close
set conn=nothing%>
