<!--#include file="conn.asp"-->
<!--#include file="check.asp"-->
<%
If Request.QueryString("style")="chk" Then
   user    =Replace(Trim(Request.Form("user")),"'","''")
   pass    =Replace(Trim(Request.Form("pass")),"'","''")
   new_pass=Replace(Trim(Request.Form("new_pass")),"'","''")
sql="select * from admin where admin='"&user&"' and password='"&pass&"' and admin='"&Session("manage")&"'"
   set rs=conn.execute(sql)
   if rs.Bof Then
	   Response.Write("<script language=javascript>alert('密码错误！！！');history.back();</script>")
	   Response.End
   End If
   sql="update admin set password='"&new_pass&"' where admin='"&Session("manage")&"'"
   conn.execute(sql)
   Response.Write("<script language=javascript>alert('更改密码成功！！！');location.replace('main.asp')</script>")
   ConnClose()
End If
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=webname%>留言本管理页面</title>
<link href="../style/css.css" rel="stylesheet" type="text/css">
<script language=javascript>
   function xxg(){
	 if (form1.pass.value==""){
	      alert("管理员的密码？");
		  form1.pass.focus();
		  return false  }
	  if (form1.new_pass.value==""){
	      alert("新管理员的密码？");
		  form1.new_pass.focus();
		  return false  }
	  if (form1.new_pass2.value==""){
	      alert("请重复输入管理员密码");
		  form1.new_pass2.focus();
		  return false  }
	  if (form1.new_pass.value!=form1.new_pass2.value){
	      alert("第一次输入密码和第二次输入的密码不一致！");
		  form1.new_pass2.focus();
		  form1.new_pass2.select();
		  return false  }
		  return true  }
</script>
</head>
<body>
<table width=480 height="264" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="5" align="center"><br>
    </td>
    <td width="475" align="center" valign="top"> 
      <form name="form1" method="post" action="password.asp?style=chk" onsubmit="return xxg()">
        <br>
        <br>
        <br>
        <br>
        <table align="center"  border="0" width=400 cellspacing="1" cellpadding="3" class="sft">
          <tr> 
            <td colspan=2 class="sfh" align="center"></td>
          </tr>
          <tr> 
            <td width="36%" align="right">原管理员名称</td>
            <td width="64%"> <input type=text name="user" size=20 value="<%=Session("manage")%>" readonly> 
            </td>
          <tr> 
            <td align="right">原管理员密码</td>
            <td> <input type=password name="pass" size=20> </td>
          </tr>
          <tr> 
            <td align="right">新管理员密码</td>
            <td> <input type=password name="new_pass" size=20> </td>
          </tr>
          <tr> 
            <td align="right">重复输入新管理员密码</td>
            <td> <input type=password name="new_pass2" size=20> </td>
          </tr>
          <tr> 
            <td colspan=2 align=center> <input type=submit value="确 定" name="submit"> 
              &nbsp;&nbsp;&nbsp;&nbsp; <input type="button" name="Submit" value="取 消" onclick=javascript:history.back()> 
            </td>
          </tr>
        </table>
        <br>
        <br>
      </form></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>
