<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/md5.asp"-->
<!--#include file="../inc/function.asp"-->
<!--#include file="checklogin.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>修改密码</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
ul{margin:0px; padding:0px;}
li{margin:2px; padding:0px;}
-->
</style>
<script type="text/javascript">
function check(obj){
	with(obj){
		if(oldpass.value==""){
			alert("原密码不能为空!");
			oldpass.focus();
			oldpass.select();
			return false;
		}
		if(newpass1.value==""){
			alert("新密码不能为空!");
			newpass1.focus();
			newpass1.select();
			return false;
		}
		if(newpass1.value!=newpass2.value){
			alert("新密码与确认密码不一致!");
			newpass1.focus();
			newpass1.select();
			return false;
		}
		return true;
	}
}
</script>
</head>

<body>
<!--#include file="top.asp"-->
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1">
  <tr>
    <td valign="top">
<%
dim act,rs
act=request.querystring("act")
if(act="do") then
	dim oldpass,newpass1,newpass12
	oldpass=request.Form("oldpass")
	oldpass=md5(oldpass,32)
	newpass1=request.Form("newpass1")
	newpass2=request.Form("newpass2")
	if(newpass1<>newpass2) then
		call alertstr("密码不一致:"&newpass1&":"&newpass2&"!",1)
	end if
	if(oldpass<>checkuserpass) then
		call alertstr("原有密码错误!",1)
	end if
	newpass1=md5(newpass1,32)
	set rs=server.CreateObject("adodb.recordset")
	rs.open "select * from t_member where UserId='"&checkusername&"'",conn,3,3
	rs("UserPass")=newpass1
	rs.update
	rs.close
	set rs=nothing
	response.Write("<p align=""center"">成功修改密码!</p>")
else
%>

	  <form id="form1" name="form1" method="post" action="?act=do" onsubmit="return check(this)">
	    <table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" class="border">
          <tr>
            <td height="28" colspan="2" class="th_title">修改密码</td>
          </tr>
          <tr>
            <td width="34%" class="td_row"><div align="right">原密码：</div></td>
            <td width="66%" class="td_row"><input name="oldpass" type="password" id="oldpass" size="20" /></td>
          </tr>
          <tr>
            <td class="td_row"><div align="right">新密码：</div></td>
            <td class="td_row"><input name="newpass1" type="password" id="newpass1" size="20" /></td>
          </tr>
          <tr>
            <td class="td_row"><div align="right">确认新密码：</div></td>
            <td class="td_row"><input name="newpass2" type="password" id="newpass2" size="20" /></td>
          </tr>
          <tr>
            <td><div align="center"></div></td>
            <td><input type="submit" name="Submit" value="确定" />
              &nbsp;&nbsp;
              <input type="reset" name="Submit2" value="取消" /></td>
          </tr>
        </table>
      </form>    
<%end if%></td>
  </tr>
</table>
</body>
</html>
<%
call connclose()
%>