<!--#include file="conn.asp"-->
<!--#include file="chklogin.asp"-->
<!--#include file="md5.asp"-->
<%
dim x 
x=request("x")
if x=1 then
call changpsd()
end if

sub changpsd()
dim rs,sql,userpsd,userpsd2
userpsd=request("userpsd")
userpsd2=request("userpsd2")

if userpsd=userpsd2 then
set rs=server.CreateObject("adodb.recordset")
sql ="Select * from kw_user where username='"&session("userid")&"'"
rs.open sql,conn,1,3
rs("userpass")=md5(userpsd,16)
rs.update
rs.close
set rs=nothing
closedb
response.write "<script>alert('修改成功!');window.close();</script> "
end if
end sub
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>修改密码</title>
<link href="css.css" rel="stylesheet" type="text/css">
</head>
<body><br>
<br>
<br>
<script language=javascript>
function CheckForm()
{
    if (document.xg.userpsd.value==""){
	alert("请输入密码！");
	document.xg.userpsd.focus();
	return false;
  }
    if (document.xg.userpsd2.value==""){
	alert("请输入确认密码！");
	document.xg.userpsd2.focus();
	return false;
  }
    if (document.xg.userpsd2.value!=document.xg.userpsd.value){
	alert("两次密码不同！");
	document.xg.userpsd.focus();
	return false;
  }
}
</script>
<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" class="left_bg">
  <tr align="center" bgcolor="#62A11C">
    <td height="30" colspan="2"><b><font color="#FFFFFF">密 码 修 改</font></b></td>
  </tr>
  <form action="changpsd.asp?x=1" method="post" name="xg" onSubmit="return CheckForm();">
  <tr align="center">
    <td width="101" height="30" align="right">用户密码：</td>
    <td width="194"><input type="password" name="userpsd"></td>
  </tr>
  <tr align="center">
    <td height="30" align="right">确认密码：</td>
    <td><input type="password" name="userpsd2"></td>
  </tr>
  <tr align="center">
    <td height="30" colspan="2"><input type="submit" name="Submit" value="确认修改"></td>
  </tr>
  </form>
</table>
</body>
</html>
