<!--#include file="pysjzx_conn.asp"-->
<!--#include file="../webconfig.asp"-->
<!--#include file=cookies.asp-->
<%if request.QueryString("action")="save" then%>
<!--#include file="../md5.asp"-->
<%
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from pysjzx_user where username='"&request.Cookies("pysjzx")("username")&"'",conn,1,3
if md5(trim(request("password"))) <> rs("userpassword") then
response.Write "<script language=javascript>alert('原密码错误，请返回重新输入');history.go(-1);</script>"
response.End
else
rs("userpassword")=md5(trim(request("password2")))
rs.Update
rs.Close
response.Cookies("pysjzx")("username")=""
response.Cookies("pysjzx")("reglx")=""
  response.write"<SCRIPT language=JavaScript>alert('您的密码修改成功，请重新登录！');"
   response.write"this.location.href='login.asp';</SCRIPT>" 
end if
response.End
end if
%>
<!--#include file=webhead.asp-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=webname%>-会员管理中心</title>
<meta content="<%=keyword%>" name="keywords">
<meta content="<%=description%>" name="description">
<link href="../css/style.css" rel="stylesheet" type="text/css">
</head>
<div align="center">
<%
set rs=server.CreateObject ("adodb.recordset")
sql="select * from pysjzx_user where username='"&replace(request.cookies("pysjzx")("username"),"'","")&"'"
rs.open sql,conn,1,1
%>
	<table border="0" width="780"   cellpadding="0" style="border-collapse: collapse" >
		<tr>
			<td width="200" valign="top" style="border: 1px solid #c0c0c0"><!--#include file="memu.asp"--></td>			
			<td valign="top" align="center">
			<div align="right">
			<table border="1" width="99%" cellspacing="1" cellpadding="3" style="border-collapse: collapse" bordercolor="#c0c0c0">
				<form name="renpassword"  method="post" action="password.asp?action=save" onSubmit="return check();"><tr>
					<td colspan="2" bgcolor="#E8F1FF">
					<p align="center"><b>修改密码</b></td>
				</tr>
				<tr>
					<td width=50% bgcolor="#F7F7F7">
					<p align="right">登<span lang="zh-cn"> 录 名：</span></td>
					<td bgcolor="#F7F7F7"><%=rs("username")%></td>
				</tr>
				<tr>
					<td bgcolor="#F7F7F7">
					<p align="right">旧 密 码<span lang="zh-cn">：</span></td>
					<td bgcolor="#F7F7F7">
					<input name="password" type="password" id="password" size="20"></td>
				</tr>
				<tr>
					<td bgcolor="#F7F7F7">
					<p align="right">新 密 码<span lang="zh-cn">：</span></td>
					<td bgcolor="#F7F7F7">
					<input name="password1" type="password" id="password1" size="20"></td>
				</tr>
				<tr>
					<td bgcolor="#F7F7F7">
					<p align="right">
					<span lang="en-us">&nbsp;</span>确认密码<span lang="zh-cn">：</span></td>
					<td bgcolor="#F7F7F7">
					<input  name="password2" type="password" id="password2" size="20"></td>
				</tr>
				<tr>
					<td colspan="2" bgcolor="#F7F7F7">
					<p align="center">
					<input class="go-wenbenkuang" type="submit" value="提   交" name="button" >
					<input class="go-wenbenkuang" type="reset" value="取   消" name="Submit"> 
					</td>
				</tr>
			</table></div>
			</form>
			</td>
		</tr>
	</table>
</div>
<%rs.Close
set rs=nothing%>
<script LANGUAGE="javascript">
<!--
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}
function check()
{
  if(checkspace(document.renpassword.password.value)) {
	document.renpassword.password.focus();
    alert("原密码不能为空！");
	return false;
  }
  if(checkspace(document.renpassword.password1.value)) {
	document.renpassword.password1.focus();
    alert("新密码不能为空！");
	return false;
  }
    if(checkspace(document.renpassword.password2.value)) {
	document.renpassword.password2.focus();
    alert("确认密码不能为空！");
	return false;
  }
    if(document.renpassword.password1.value != document.renpassword.password2.value) {
	document.renpassword.password1.focus();
	document.renpassword.password1.value = '';
	document.renpassword.password2.value = '';
    alert("新密码和确认密码不相同，请重新输入");
	return false;
  }
	document.renpassword.submit();
  }
//-->
</script> 
<!--#include file=webfoot.asp-->