<!--#include file="../act_inc/ACT.User.asp"-->
<!--#include file="../act_inc/md5.asp"-->
<!--#include file="../ACT_inc/ACT.U_M.ASP"-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>用户管理中心</title>
<link href="Images/css/css.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/javascript" src="../editor/fckeditor/fckeditor.js"></script>
<script type='text/javascript' src='../ACT_INC/WebTime/WdatePicker.js'></script>

</head>
<body>
<% 
		 Dim  UserHS
		 Set UserHS = New ACT_User
		IF Cbool(UserHS.UserLoginChecked)=false then
		  Response.Write "<script>top.location.href ='login.asp' ;</script>"
		  Response.end
		End If
		%>
		<table width="98%" height=20 border=0 align="center" cellPadding=2 cellSpacing=1 borderColor=#111111 class="table" id=AutoNumber3 style="BORDER-COLLAPSE: collapse">
            <tr>
              <td height=20 class="bg_tr"><B>个人资料修改</B></td>
              <td width=583 height=20 align=right class="bg_tr"><a href="Edit_User.asp"><font color=red>·基本信息</font></a>&nbsp;&nbsp;·<a href="Edit_User.asp?Action=ContactInfo">联系信息</a>&nbsp;&nbsp;·<a href="Edit_User.asp?Action=PassInfo">密码设置</a>&nbsp;&nbsp;</td>
            </tr>
</table>
		<%
		Select Case ACTCMS.S("Action")
		  Case "ContactInfo"
		   Call ContactInfo()
		  Case "PassInfo"
		   Call PassInfo()
		  Case "PassSave"
		   Call PassSave()
		  Case "PassQuestionSave"
		   Call PassQuestionSave()
		  Case "BasicInfoSave"
		   Call BasicInfoSave()
		  Case "ContactInfoSave"
		   Call ContactInfoSave()
		  Case Else
		   Call EditBasicInfo()
		End Select

	   '基本信息
	   Sub EditBasicInfo()
		   %>
          <script>
	
       	 <!----检查用户名，电子邮箱结束-->
      function CheckForm() 
		{ 
			
			if (document.tcjdxr.RealName.value =="")
			{
			alert("请填写您的真实姓名！");
			document.tcjdxr.RealName.focus();
			return false;
			}
			if (document.tcjdxr.Sex.value =="")
			{
			alert("请选择您的性别！");
			document.tcjdxr.Sex.focus();
			return false;
			}
		  return true;	
		}
    </script>
          
          <table  cellspacing="1" cellpadding="3" class="table" width="98%" align="center" border="0">
					  <form action="Edit_User.asp?Action=BasicInfoSave" method="post" name="tcjdxr" id="tcjdxr" onSubmit="return CheckForm();">
                          <tr class="title">
                            <td height="22" colspan="2" align="center" class="bg_tr"> 基 本 资 料 </td>
                          </tr>
                          <tr class="tdbg">
                            <td width="22%" height="22" class="td_bg"><span style="font-weight: bold"> 会员名称： </span><br></td>
                            <td width="78%" class="td_bg">&nbsp;
                            <input  class="textbox" type="text" name="username" size="30" value="<%=UserHS.username%>" disabled="disabled" />
                            用于登录会员中心的账号，不可修改。</td>
                          </tr>
                          <tr class="tdbg">
                            <td width="22%" height="22" class="td_bg"><span style="font-weight: bold"> 真实姓名：</span><br>
                            请务必填写真实姓名</td>
                            <td width="78%" class="td_bg">&nbsp;&nbsp;
                              <input name="RealName" class="textbox" type="text" id="RealName" value="<%=UserHS.Realname%>" size="30" maxlength="50" />
                            <span style="color: red">* </span></td>
                          </tr>
                          <tr class="tdbg">
                            <td width="22%" height="22" class="td_bg"><span style="font-weight: bold">性&nbsp;&nbsp;&nbsp; 别：</span><br>
							请选择您的性别</td>
                            <td width="78%" class="td_bg">&nbsp;&nbsp;
                                <select name="Sex" id="Sex" style="width:110">
                                  <option value="">==请选择性别==</option>
                                  <option value="0" <%if UserHS.sex="0" then%> selected="selected" <%else%><%end if%>>男</option>
                                  <option value="1" <%if UserHS.sex="1" then%> selected="selected" <%else%><%end if%>>女</option>
                                </select>
                            <span style="color: red">* </span></td>
                         
                          <tr class="tdbg">
                            <td width="22%" height="22" class="td_bg"><span style="font-weight: bold">  出生日期：</span><br>
                            请填写正确的出生日期，格式：0000-00-00</td>
                            <td width="78%" class="td_bg">&nbsp;&nbsp;
                                <input name="Birthday" class="textbox" type="text" id="Birthday" value="<%=UserHS.Birthday%>" size="30" maxlength="50" />
                            <span style="color: red">*</span></td>
                          </tr>
                          <tr class="tdbg">
                            <td height="22" class="td_bg"><span style="font-weight: bold">隐私设定：</span><br>开放后别人可以看到您的性别、Email、QQ等信息</td>
                            <td class="td_bg">&nbsp;
                              <input type="radio" <%if UserHS.Privacy=0 Then Response.Write "checked=""checked"""%> value="0" name="Privacy" />
                              公开全部信息(包括真实姓名/电话号码/生日等) <br />
                              &nbsp;
                              <input type="radio" value="1" name="Privacy" <%if UserHS.Privacy=1 Then Response.Write "checked=""checked"""%>/>
                              公开部分信息(只公开QQ/Email等网上联络的信息) <br />
                              &nbsp;
                              <input type="radio" value="2" name="Privacy" <%if UserHS.Privacy=2 Then Response.Write "checked=""checked"""%>/>
                              完全保密(别人只能查看你的昵称) </td>
                          </tr>
                        
                          <tr class="tdbg">
                            <td width="22%" height="30" class="td_bg">&nbsp;</td>
                            <td width="78%" class="td_bg"><input  class="ACT_btn" name="Submit" type="submit"  value=" 修 改 " />
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input  class="ACT_btn" name="Submit2" type="reset" value=" 重 填 " />                            </td>
                          </tr>
		    </form>
</table>
          <%
  End Sub
  
  '联系信息
  Sub ContactInfo()
		   %>
          <script>

		function OpenWindowAndSetValue(Url,Width,Height,WindowObj,SetObj)
		{
			var ReturnStr=showModalDialog(Url,WindowObj,'dialogWidth:'+Width+'pt;dialogHeight:'+Height+'pt;status:yes;help:no;scroll:yes;');
			if (ReturnStr!='') SetObj.value=ReturnStr;
			return ReturnStr;
		}	
	      function CheckForm() 
		{ 
			if (document.tcjdxr.OfficeTel.value =="")
			{
			alert("请填写您的办公电话！");
			document.tcjdxr.OfficeTel.focus();
			return false;
			}
			if (document.tcjdxr.Email.value =="")
			{
			alert("请输入您的电子信箱！");
			document.tcjdxr.Email.focus();
			return false;
			}
			if((document.tcjdxr.Email.value.indexOf("@")==-1)||(document.tcjdxr.Email.value.indexOf(".")==-1))
				{
				alert("您输入的电子邮件地址有误！");
				document.tcjdxr.Email.focus();
				return false;
				}
	   return true;			
		}
    </script>
          <table  cellspacing="1" cellpadding="3" class="table" width="98%" align="center" border="0">
					  <form action="Edit_User.asp?Action=ContactInfoSave" method="post" name="tcjdxr" id="tcjdxr" onSubmit="return CheckForm();">
                          <tr class="title">
                            <td height="22" colspan="2" align="center" class="bg_tr"> 联 系 信 息 </td>
                          </tr><tr class="tdbg">
                            <td width="16%" height="22" align="right" class="td_bg"><span style="font-weight: bold"> 电子邮箱：</span><br></td>
                            <td width="84%" class="td_bg">&nbsp;
                            <input  class="textbox" name="Email" type="text" id="Email" value="<%=UserHS.Email%>" size="35" maxlength="50" />
                            <span style="color: red">* 请输入有效的邮件地址。</span></td>
                          </tr>
							<%
							Call  U_M.ACT_MXEdit(UserHS.UModeID,UserHS.UserID) %>
                          <tr class="tdbg">
                            <td height="22" align="right" class="td_bg"><span style="font-weight: bold">所在地区：</span><br></td>
                            <td class="td_bg">&nbsp;
                              <select name="prov" onChange="selectcityarea('prov','city','tcjdxr');" style="width:110">
                                <%if UserHS.Province<>"" then%>
                                <option  value="<%=UserHS.Province%>" selected="selected"><%=UserHS.Province%></option>
                                <%else%>
                                <option  value="" selected="selected">==请选择省份==</option>
                                <%end if%>
                              </select>
                              <select name="city" style="width:110">
                                <%if UserHS.city<>"" then%>
                                <option  value="<%=UserHS.city%>" selected="selected"><%=UserHS.city%></option>
                                <%else%>
                                <option  value="" selected="selected">==请选择城市==</option>
                                <%end if%>
                              </select>
                              选择您所在的省份和城市。</td>
                          </tr>
                      <!--省份城市的调用开始---->
                      <script language="JavaScript" src="<%=ACTCMS.ActCMSDM%>act_inc/Province.js" type="text/javascript"></script>
                      <!----省份城市调用结束---->
                         
                          <tr class="tdbg">
                            <td height="30" class="td_bg">&nbsp;</td>
                            <td width="84%" class="td_bg"><input  class="ACT_btn" name="Submit" type="submit"  value=" 修 改 " />
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input  class="ACT_btn" name="Submit2" type="reset" value=" 重 填 " />                            </td>
                          </tr>
		    </form>
</table>
          <%
  End Sub
  
  '设置密码
  Sub PassInfo()
  		   %>
          <script>
	      function CheckForm() 
		{ 
			if (document.tcjdxr.oldpassword.value =="")
			{
			alert("请填写您的旧密码！");
			document.tcjdxr.oldpassword.focus();
			return false;
			}
			if (document.tcjdxr.newpassword.value =="")
			{
			alert("请输入您的新密码！");
			document.tcjdxr.newpassword.focus();
			return false;
			}
			if (document.tcjdxr.renewpassword.value =="")
			{
			alert("请输入您的新确认密码！");
			document.tcjdxr.renewpassword.focus();
			return false;
			}
			if (document.tcjdxr.newpassword.value !=document.tcjdxr.renewpassword.value)
			{
			alert("两次输入的密码不一致！");
			document.tcjdxr.renewpassword.focus();
			return false;
			}
          return true;			
		}
	      function CheckForm1() 
		{ 
			if (document.tcjdxr1.Password.value =="")
			{
			alert("请填写您的登录密码！");
			document.tcjdxr1.Password.focus();
			return false;
			}
			if (document.tcjdxr1.Question.value =="")
			{
			alert("请输入您的密码问题！");
			document.tcjdxr1.Question.focus();
			return false;
			}
			if (document.tcjdxr1.Answer.value =="")
			{
			alert("请输入您的问题答案！");
			document.tcjdxr1.Answer.focus();
			return false;
			}

          return true;			
		}
    </script>
          <table  cellspacing="1" cellpadding="3" class="table" width="98%" align="center" border="0">
					  <form action="Edit_User.asp?Action=PassSave" method="post" name="tcjdxr" id="tcjdxr" onSubmit="return CheckForm();">
                          <tr class="title">
                            <td height="22" colspan="2" align="center" class="bg_tr"> 修 改 密 码 </td>
                          </tr>
                          <tr class="tdbg">
                            <td width="28%" height="22" class="td_bg"><span style="font-weight: bold">旧 密 码： </span><br>
                            您的旧登录密码，必须正确填写。</td>
                            <td width="72%" class="td_bg">&nbsp;
                            <input name="oldpassword" class="textbox" type="password" id="oldpassword" size="30" maxlength="50" />
                            <span style="color: red">*</span></td>
                          </tr>
                          <tr class="tdbg">
                            <td width="28%" height="22" class="td_bg"><span style="font-weight: bold"> 新 密 码：</span><br>
							请输入您的新密码！</td>
                            <td width="72%" class="td_bg">&nbsp;
                              <input name="newpassword" class="textbox" type="password" id="newpassword" size="30" maxlength="50" />
                            <span style="color: red">* </span></td>
                          </tr>
                          <tr class="tdbg">
                            <td width="28%" height="22" class="td_bg"><span style="font-weight: bold"> 确认密码：</span><br>
同上。</td>
                            <td width="72%" class="td_bg">&nbsp;
                              <input name="renewpassword" class="textbox" type="password" id="renewpassword" size="30" maxlength="50" />
                            <span style="color: red">* </span></td>
                          </tr>
                          
						<tr class="tdbg">
                            <td width="28%" height="30" class="td_bg">&nbsp;</td>
                            <td width="72%" class="td_bg"><input  class="ACT_btn" name="Submit"  type="submit"  value=" 修 改 " />
                          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input  class="ACT_btn" name="Submit2" type="reset" value=" 重 填 " />                            </td>
                        </tr>
		    </form>
</table>
          <br>
          <table  cellspacing="1" cellpadding="3" class="table" width="98%" align="center" border="0">
					  <form action="Edit_User.asp?Action=PassQuestionSave" method="post" name="tcjdxr1" id="tcjdxr1" onSubmit="return CheckForm1();">
                          <tr class="title">
                            <td height="22" colspan="2" align="center" class="bg_tr">更 改 找 回 密 码 设 置</td>
                          </tr>
                          <tr class="tdbg">
                            <td width="28%" height="22" class="td_bg"><span style="font-weight: bold"> 登录密码：</span><br>
同上。</td>
                            <td width="72%" class="td_bg">&nbsp;
                              <input name="Password" class="textbox" type="password" id="Password" size="30" maxlength="50" />
                            <span style="color: red">* </span></td>
                          </tr>
                          <tr class="tdbg">
                            <td width="28%" height="22" class="td_bg"><span style="font-weight: bold"> 密码问题：</span><br>
                            当密码忘记时，取回密码的提示问题。</td>
                            <td width="72%" class="td_bg">&nbsp;
                            <input name="Question" class="textbox" type="text" id="Question" value="<%=UserHS.Question%>" size="30" maxlength="50" />
                            <span style="color: red">* </span></td>
						</tr>
                          <tr class="tdbg">
                            <td width="28%" height="22" class="td_bg"><span style="font-weight: bold"> 问题答案：</span><br>
                            当密码忘记时，取回密码提示问题的答案。</td>
                            <td width="72%" class="td_bg">&nbsp;
                            <input name="Answer" class="textbox" type="text" id="Answer" value="<%=UserHS.Answer%>" size="30" maxlength="50" />
                            <span style="color: red">* </span></td>
						</tr>
                          
						<tr class="tdbg">
                            <td width="28%" height="30" class="td_bg">&nbsp;</td>
                            <td width="72%" class="td_bg"><input  class="ACT_btn" name="Submit" type="submit"  value=" OK,修 改 " />
                          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input  class="ACT_btn" name="Submit2" type="reset" value=" 重 填 " />                            </td>
                        </tr>
		    </form>
</table>
          <%
  End SUb
  
  Sub BasicInfoSave() 
				 Dim RealName:RealName=ACTCMS.S("RealName")
				 Dim Sex:Sex=ACTCMS.S("Sex")
				 Dim Birthday:Birthday=ACTCMS.S("Birthday")
				 Dim Privacy:Privacy=ACTCMS.S("Privacy")
				 If Not IsDate(Birthday) Then
				  Response.Write "<script>alert('出生日期格式有误!');history.back();</script>"
				  response.end
				 end if
            Dim RS: Set RS=Server.CreateObject("Adodb.RecordSet")
			  RS.Open "Select * From "&UserHS.TableName(UserHS.UModeID)&" Where UserName='" & UserHS.UserName & "'",Conn,1,3
			  IF RS.Eof And RS.Bof Then
				 Response.End
			  Else
				 RS("RealName")=RealName
				 RS("Sex")=Sex
				 RS("Birthday")=Birthday
				 RS("Privacy")=Privacy
		 		 RS.Update
				 Response.Write "<script>alert('会员基本信息资料修改成功！');location.href='right.asp';</script>"
				 Response.End()
			  End if
			RS.Close:Set RS=Nothing
  End Sub
  '保存联系信息
		  Sub ContactInfoSave()
				Dim IF_NULL,i
				IF_NULL=U_M.Act_U_MX_Arr(UserHS.UModeID)
				If IsArray(IF_NULL) Then
				For I=0 To Ubound(IF_NULL,2)
				 If IF_NULL(2,I)=0 And Trim(ACTCMS.S(IF_NULL(0,I)))="" Then  Call  ACTCMS.ALERT(IF_NULL(1,I)&"不能为空","")
				Next
				End If


				 Dim Email:Email=ACTCMS.S("Email")
				 if ACTCMS.IsValidEmail(Email)=false then
					 Response.Write("<script>alert('请输入正确的电子邮箱!');history.back();</script>")
					 Exit Sub
				 end if
			
				 Dim OfficeTel:OfficeTel=ACTCMS.S("OfficeTel")
				 Dim HomeTel:HomeTel=ACTCMS.S("HomeTel")
				 Dim Mobile:Mobile=ACTCMS.S("Mobile")
				 Dim Fax:Fax=ACTCMS.S("Fax")
				 Dim province:province=ACTCMS.S("prov")
				 Dim city:city=ACTCMS.S("city")
				 Dim ZIP:ZIP=ACTCMS.S("ZIP")
				 Dim HomePage:HomePage=ACTCMS.S("HomePage")
				 Dim QQ:QQ=ACTCMS.S("QQ")		 
				 Dim MSN:MSN=ACTCMS.S("MSN")		 
			
			 
              Dim RS:Set RS=Server.CreateObject("Adodb.RecordSet")
			  RS.Open "Select * From "&UserHS.TableName(UserHS.UModeID)&" Where UserName='" & UserHS.UserName & "'",Conn,1,3
			  IF RS.Eof And RS.Bof Then
				 Response.End
			  Else
				 RS("Email")=Email
				 RS("Province")=Province
				 RS("City")=City
				If IsArray(IF_NULL) Then
					For I=0 To Ubound(IF_NULL,2)
						RS("" & IF_NULL(0,I) & "")=ACTCMS.S(IF_NULL(0,I))
					Next
				End If
		 		 RS.Update
				 Response.Write "<script>alert('您的联系信息修改成功！');location.href='right.asp';</script>"
				 Response.End()
			  End if
			RS.Close:Set RS=Nothing
  End Sub
  '保存密码设置
  Sub PassSave()
		     Dim Oldpassword:Oldpassword=ACTCMS.S("Oldpassword")
			 Dim NewPassWord:NewPassWord=ACTCMS.S("NewPassWord")
			 Dim ReNewPassWord:ReNewPassWord=ACTCMS.S("ReNewPassWord")
			 If Oldpassword = "" Then
				 Response.Write("<script>alert('请输入旧登录密码!');history.back();</script>")
				 Response.End
              End IF
			 If NewPassWord = "" Then
				 Response.Write("<script>alert('请输入登录密码!');history.back();</script>")
				 Response.End
			 ElseIF ReNewPassWord="" Then
				 Response.Write("<script>alert('请输入确认密码');history.back();</script>")
				 Response.End
			 ElseIF NewPassWord<>ReNewPassWord Then
				 Response.Write("<script>alert('两次输入的密码不一致');history.back();</script>")
				 Response.End
			 End If
			 
			 OldPassWord =MD5(OldPassWord)
			 NewPassWord =MD5(NewPassWord)
			 
             Dim RS:Set RS=Server.CreateObject("Adodb.RecordSet")
			  RS.Open "Select PassWord From "&UserHS.TableName(UserHS.UModeID)&" Where UserName='" & UserHS.UserName & "' And PassWord='" & OldPassWord & "'",Conn,1,3
			  IF RS.Eof And RS.Bof Then
			  	 Response.Write("<script>alert('您输入的旧密码有误！');history.back();</script>")
				 Response.End
			  Else
			     RS(0)=NewPassWord
				 RS.Update
				 Response.Cookies(AcTCMSN)("PassWord") = NewPassWord
			  End if
			 			RS.Close:Set RS=Nothing
  %>
          <table class="border" cellspacing="1" cellpadding="2" width="98%" align="center" border="0">
            <tbody>
			  <tr class="title">
			   <td height="25" align=center>密码修改成功</td>
		      </tr>
              <tr class="tdbg">
                <td height="42" align="center">您的会员登录密码修改成功！新密码 <font color="red"><%=ACTCMS.S("NewPassWord")%></font> 请牢记。 </td>
              </tr>
              <tr class="tdbg">
                <td height="42" align="center"><input type="button" onClick="location.href='right.asp'" class="ACT_btn" value="进入会员首页">
                &nbsp;&nbsp;<input type="button" onClick="top.location.href='userlogout.asp'" value="退出重新登录" class="ACT_btn"></td>
              </tr>
            </tbody>
          </table>
          <%
  End Sub
  '提示问题保存
  Sub PassQuestionSave()
				 Dim PassWord:PassWord=ACTCMS.S("PassWord")
				 Dim Question:Question=ACTCMS.S("Question")
				 Dim Answer:Answer=ACTCMS.S("Answer")
				
                 PassWord=MD5(PassWord)
              Dim RS: Set RS=Server.CreateObject("Adodb.RecordSet")
			  RS.Open "Select * From "&UserHS.TableName(UserHS.UModeID)&" Where UserName='" & UserHS.UserName & "' And PassWord='" & PassWord & "'",Conn,1,3
			  IF RS.Eof And RS.Bof Then
				rs.close:set rs=nothing
				Response.Write "<script>alert('您输入的登录密码不正确!');history.back();</script>"
				Exit Sub
			  Else
			     RS("Question")=Question
				 RS("Answer")=Answer
		 		 RS.Update
				 Response.Write "<script>alert('你的密码找回资料修改成功！');location.href='right.asp';</script>"
				 Response.End()
			  End if
			RS.Close:Set RS=Nothing
  End Sub
%> 
