<!--#include file="../Conn.asp" -->
<!--#include file="../Comm/Site_Class.asp" -->
<!--#include file="../Comm/md5.asp" -->
<%
Dim strMenu,PageTitle
strMenu = ""
PagePath = "../"

Set Qsite = New Site_Class

Qsite.SiteConfig()
Qsite.GotoErrPage()

PageTitle = Qsite.SiteName & " - 企业会员管理中心"
 Qsite.SiteTopPerson()
%>
<!--#include file="Check_Login.asp" -->
<%
Dim Rs,UserName,OldQuestion
Dim OldPassWord,NewPassWord,NewPassWord2,Question,OldAnswer,NewAnswer,OldEmail,Email
Set Rs = server.CreateObject("ADODB.recordset")

If Request.Form <> "" Then
	OldPassWord = Qsite.chgStr(Trim(Request.Form("OldPassWord")))
	NewPassWord = Qsite.chgStr(Trim(Request.Form("NewPassWord")))
	NewPassWord2 = Qsite.chgStr(Trim(Request.Form("NewPassWord")))
	OldEmail = Qsite.chgStr(Trim(Request.Form("OldEmail")))
	Email = Qsite.chgStr(Trim(Request.Form("Email")))
	
	If OldPassWord = "" Then
		Qsite.ShowMsg "请输入原密码" , ""
	End If
	If NewPassWord <> "" Then
		If Qsite.CheckStr(NewPassWord , "&|<|>|\|'") = True Then
			Qsite.ShowMsg "输入的新密码含有非法字符，请返回重新输入" , ""
		End If
	End If
	If NewPassWord2 <> "" Then
		If Qsite.CheckStr(NewPassWord2 , "&|<|>|\|'") = True Then
			Qsite.ShowMsg "输入的确认新密码含有非法字符，请返回重新输入" , ""
		End If
	End If
	If (NewPassWord <> "" Or NewPassWord2 <> "") And NewPassWord <> NewPassWord2 Then
		Qsite.ShowMsg "输入的两次新密码不一致，请返回重新输入" , ""
	End If
	If Email = "" Then
		Qsite.ShowMsg "电子信箱必须填写" , ""
	End If
	If Not Qsite.IsValidEmail(Email) Then
		Qsite.ShowMsg "输入的电子信箱不正确，请返回重新输入" , ""
	End If
	
	Rs.Open "select * from CompanyTbl where Email = '"& Email &"' and ComId <> "& Session("ComId") , Conn , 1 , 1
	If Not Rs.Eof Then
		Qsite.ShowMsg "此电子信箱已经注册，请返回重新输入" , ""
	End If
	Rs.Close
	
	Rs.Open "select * from CompanyTbl where ComId = "& Session("ComId") &" and UserName = '"& Session("UserName") &"'" , Conn , 3 , 2
	If Rs.Eof Then
		Qsite.ShowMsg "请不要提交非法参数" , "../Index.asp"
	Else
		If Rs("PassWord") <> MD5(OldPassWord) Then
			Qsite.ShowMsg "输入的原密码不正确" , ""
		Else
			If NewPassWord <> "" Then
				Rs("PassWord") = MD5(NewPassWord)
				Session("PassWord") = MD5(NewPassWord)
			End If
			Rs("Email") = Email
			Rs.Update
		End If
	End If
	Rs.Close
	Qsite.ShowMsg "资料修改成功" , "ChgComInfo_1.asp"
	
End If

Rs.Open "select * from CompanyTbl where ComId = "& Session("ComId") &" and UserName = '"& Session("UserName") &"'" , Conn , 1 , 1
If Rs.Eof Then
	Qsite.ShowMsg "请不要提交非法参数" , "../Index.asp"
Else
	OldQuestion = Rs("Question")
	Email = Rs("Email")
End If
Rs.Close
%>
<script language="javascript" src="../Comm/Comm.js"></script>
<script language="javascript">
	function CheckForm()
	{
		if(ComForm.OldPassWord.value == "")
		{
			alert("要修改帐号资料，必须得填写原登录密码");
			ComForm.OldPassWord.focus();
			return false;
		}
		if(ComForm.NewPassWord.value != "")
		{
			if(!checkLength("NewPassWord" , "新密码" , 6 , 16 , "&<>\'"))
				return false;
		}
		if(ComForm.NewPassWord2.value != "")
		{
			if(!checkLength("NewPassWord2" , "确认新密码" , 6 , 16 , "&<>\'"))
				return false;
		}
		if(ComForm.NewPassWord.value != ComForm.NewPassWord2.value)
		{
			alert("两次输入的新密码不一致");
			return false;
		}
		if(ComForm.Question.value != ComForm.OldQuestion.value && ComForm.OldAnswer.value == "")
		{
			alert("要修改提示问题，必须填写原答案");
			ComForm.OldAnswer.focus();
			return false;
		}
		if(ComForm.Email.value == "")
		{
			alert("电子信箱必须填写");
			ComForm.Email.focus();
			return false;
		}
		if(!checkEmail("Email" , "电子信箱"))
			return false;
		return true;
	}
</script>
 <table width="974" height="413" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr> 
        <td width="181" valign="top"> 
<!--#include file="Left_Menu.asp" -->
         </td>
        <td width="793" align="left" valign="top">
<table width="768" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td height="26" background="../images/Member_Center_r7_c8.jpg"><table width="768" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="60">&nbsp;</td>
                    <td width="708"><span style="font-size:14px;color:#FF7706"><b>会员密码修改</b></span><span style="font-size:14px;color:#333333"> 
                      <strong>Sign Up</strong></span></td>
                  </tr>
                </table></td>
            </tr>
            <tr>
              <td height="136" align="left" valign="top" background="../images/Member_Center_r10_c8.jpg" style="padding-top:5px;padding-left:10px;padding-right:10px;padding-bottom:5px;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr> 
                    <td width="100%" height="23"><img src="../images/ico_2.gif" width="15" height="12" align="absmiddle" />友情提示：为了您的帐户安全，建议您不定期的进行密码修改！</td>
                  </tr>
                </table>
                <table width="100%" height="7" border="0" cellpadding="0" cellspacing="0">
                  <tr height="1">
                    <td background="../images/ico_point.gif"></td>
                  </tr>
				  <tr height="6">
                    <td></td>
                  </tr>
                </table>
                <table width="100%" border="0" cellspacing="0" cellpadding="3">
                  <tr><form id="ComForm" name="ComForm" method="post" action="ChgComInfo_1.asp" style="margin:0" onsubmit="return CheckForm();">
                    <td width="22%" align="right">会员帐号：</td>
                    <td width="78%" align="left">
                       <input name="UserName" type="text" id="UserName" size="30" value="<%=Session("UserName")%>" disabled="disabled"  /> (用户名不能修改！)
                    </td>
                  </tr>
                  <tr>
                    <td align="right">原始密码：</td>
                    <td align="left">
                        <input name="OldPassWord" type="password"  id="OldPassWord" size="30" /> (修改资料必须填写原密码)
                    </td>
                  </tr>
                  <tr>
                    <td align="right">新 密 码：</td>
                    <td align="left">
                        <input name="NewPassWord" type="password"  id="NewPassWord" size="30" /> (6-16个字符)(如果不修改密码，请留空)</td>
                  </tr>
                  <tr>
                    <td align="right">
                        确认密码：</td>
                    <td align="left">
                       <input name="NewPassWord2" type="password"  id="NewPassWord2" size="30" /> (再输入一次新密码)</td>
                  </tr>
                  <tr>
                    <td align="right">
                       电子信箱：</td>
                    <td align="left">
                      <input name="Email" type="text" id="Email" size="30"  value="<%=Email%>" /><input name="OldEmail" type="hidden" id="OldEmail" value="<%=Email%>" />
								(取回密码时，密码发至此邮箱)</td>
                  </tr>
                    <tr>
                        
                    <td height="53" align="right"> </td>
                        <td align="left">
                           <input type="submit" name="Submit" value=" 修  改 " />
								&nbsp;
								<input type="reset" name="Submit" value=" 重  置 " /></td>
                    </tr>
                </table>
                <table width="100%" height="1" border="0" cellpadding="0" cellspacing="0">
                  <tr height="1"> </form>
                    <td background="../images/ico_point.gif"></td>
                  </tr>
                </table></td>
            </tr>
            <tr height="14">
              <td height="14" background="../images/Member_Center_r18_c8.jpg"></td>
            </tr>
          </table></td>
      </tr>
    </table>
 
<table width="974" height="8" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr height="8">
        <td height="8"></td>
      </tr>
    </table>
<%
Qsite.Bottom()
%>