<%@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="../uc_api/uc_client/client.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")
	
	newpass1=request.Form("newpass1")
	newpass2=request.Form("newpass2")
	if(newpass1<>newpass2) then
		call alertstr("密码不一致:"&newpass1&":"&newpass2&"!",1)
	end if
	'''''''
	'UC绑定
	'''''''
	if(BindUc=true) then
		uc_result = uc_user_edit(checkusername, oldpass, newpass1,"",0,"","")
		uc_result =CInt(uc_result)
		If uc_result =-1 Then 
			call alertstr("旧密码不正确",1)
		ElseIf uc_result = -4 Then 
			call alertstr("Email 格式有误",1)
		ElseIf uc_result = -5 Then 
			call alertstr("Email 不允许注册",1)
		ElseIf uc_result = -6 then
			call alertstr("该 Email 已经被注册",1)
		ElseIf uc_result = 0 then
			call alertstr("没有做任何修改",1)
		Else
			'call alertstr("修改成功！"&uc_result,1)
		End If 				
	end if
	oldpass=Php_MD5(oldpass)
	newpass1=Php_MD5(newpass1)
	set rs=server.CreateObject("adodb.recordset")
	rs.open "select * from t_member where UserId='"&checkusername&"' and UserPass='"&oldpass&"'",conn,3,3
	if not rs.eof then
		rs("UserPass")=newpass1
		rs.update
		rs.close
		set rs=nothing
	else
		rs.close
		set rs=nothing
		call alertstr("原有密码错误!",1)
	end if	
	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()
%>