<!--#include file="../Inc/Cls_DB.asp" -->
<!--#include file="../Inc/Const.asp" -->
<!--#include file="../Inc/Function.asp" -->
<!--#include file="../Inc/Md5.asp" -->
<%
Dim DBC,Conn
Set DBC = New DataBaseClass
Set Conn = DBC.OpenConnection()
Set DBC = Nothing
%>
<!--#include file="../Inc/MemberCheck.asp" -->
<%
if request.Form("action")="modifychange" then
  if request.Form("OldPassword")="" then
	  Response.Write("<script>alert(""请输入旧密码"");location=""javascript:history.back()"";</script>")  
	  Response.End
  end if
  if request.Form("NewPassword")="" then
	  Response.Write("<script>alert(""请输入新密码"");location=""javascript:history.back()"";</script>")  
	  Response.End
  end if
  if request.Form("ConfimPassword")="" then
	  Response.Write("<script>alert(""请输入确认新密码"");location=""javascript:history.back()"";</script>")  
	  Response.End
  end if
  if request.Form("ConfimPassword")<>request.Form("NewPassword") then
	  Response.Write("<script>alert(""两次输入密码不正确"");location=""javascript:history.back()"";</script>")  
	  Response.End
  end if
  
Set Rs1 = server.createobject("adodb.recordset")
SQL1 = "select * from members where MemName='"&Session("MemName")&"' and Password='"&MD5(Replace(Trim(Request.Form("OldPassword")),"'","''"),16)&"'"
Rs1.open SQL1,Conn,1,1
if Not Rs1.eof then
  Set RsConfig = server.createobject("adodb.recordset")
  SQL = "select * from members where MemName='"&Session("MemName")&"' and Password='"&Session("MemPassWord")&"'"
  RsConfig.open SQL,Conn,1,3
  if Not Rsconfig.eof then
  Rsconfig("password")=md5(Replace(Trim(Request.Form("NewPassWord")),"'","''"),16)
  RsConfig.update
  RsConfig.close
  Set Rsconfig=nothing
	  Response.Write("<script>alert(""修改密码成功"");location=""UserMain.asp"";</script>")  
	  Response.End
  else
	  Response.Write("<script>alert(""脚本过期"");location=""javascript:history.back()"";</script>")  
	  Response.End
  end if
else
  Rs1.close
  set Rs1=nothing
	  Response.Write("<script>alert(""你输入的旧密码不正确或者没有此用户"");location=""javascript:history.back()"";</script>")  
	  Response.End
end if	
 end if
 
 if request.Form("action")="anchange" then
  if request.Form("PassQuestion")="" then
	  Response.Write("<script>alert(""新问题不能为空"");location=""javascript:history.back()"";</script>")  
	  Response.End
  end if
  if request.Form("PassAnswer1")="" then
	  Response.Write("<script>alert(""新密码答案不能为空"");location=""javascript:history.back()"";</script>")  
	  Response.End
  end if
 if request.Form("ConfimPassAnswer1")<>request.Form("PassAnswer1") then
 	  Response.Write("<script>alert(""两次输入的新答案不相同"");location=""javascript:history.back()"";</script>")  
	  Response.End
  end if
  
Set Rs1 = server.createobject("adodb.recordset")
SQL1 = "select * from members where MemName='"&Session("MemName")&"' and PassAnswer='"&Replace(Trim(Request.Form("PassAnswer")),"'","''")&"'"
Rs1.open SQL1,Conn,1,1
if Not Rs1.eof then
  Set RsConfig = server.createobject("adodb.recordset")
  SQL = "select * from members where MemName='"&Session("MemName")&"' and Password='"&Session("MemPassWord")&"'"
  RsConfig.open SQL,Conn,1,3
  if Not Rsconfig.eof then
  Rsconfig("PassQuestion")=Replace(Trim(Request.Form("PassQuestion")),"'","''")
  Rsconfig("PassAnswer")=Replace(Trim(Request.Form("PassAnswer1")),"'","''")
  RsConfig.update
  RsConfig.close
  Set Rsconfig=nothing
	  Response.Write("<script>alert(""修改密码提示问题成功"");location=""Usermain.asp"";</script>")  
	  Response.End
  else
	  Response.Write("<script>alert(""脚本过期！"");location=""javascript:history.back()"";</script>")  
	  Response.End
  end if
else
  Rs1.close
  set Rs1=nothing
 	  Response.Write("<script>alert(""你输入的旧密码答案不正确或者没有此用户"");location=""javascript:history.back()"";</script>")  
	  Response.End
end if	
 end if
 
if request.Form("action")="usermodify" then
   if IsValidEmail(request.Form("Email"))=false then
 	  Response.Write("<script>alert(""电子邮件有错误，请重新填写"");location=""javascript:history.back()"";</script>")  
	  Response.End
   end if
      Dim RsUseradd,SqlUseradd
      set RsUseradd = server.CreateObject ("ADODB.RecordSet")
      SqlUseradd = "select * from Members where ID="&Replace(Trim(Request.Form("MemID")),"'","''")&""
      RsUseradd.Open SqlUseradd,Conn,1,3
	  RsUseradd("Name")=Replace(Trim(Request.Form("Uname")),"'","''")
	  RsUseradd("HeadPic")=Replace(Trim(Request.Form("HeadPic")),"'","''")
	  if request.form("Birthday")<>"" then
		  RsUseradd("Birthday")=formatdatetime(request.form("Birthday"))
	  end if
	  RsUseradd("Email")=Replace(Trim(Request.Form("Email")),"'","''")
	  RsUseradd("Telephone")=Replace(Trim(Request.Form("Telephone")),"'","''")
	  RsUseradd("Oicq")=Replace(Trim(Request.Form("Oicq")),"'","''")
	  RsUseradd("MSN")=Replace(Trim(Request.Form("MSN")),"'","''")
	  RsUseradd("HomePage")=Replace(Trim(Request.Form("HomePage")),"'","''")
	  RsUseradd("Vocation")=Replace(Trim(Request.Form("Vocation")),"'","''")
	  RsUseradd("EduLevel")=Replace(Trim(Request.Form("EduLevel")),"'","''")
	  RsUseradd("Corner")=Replace(Trim(Request.Form("Corner")),"'","''")
	  RsUseradd("Province")=Replace(Trim(Request.Form("Province")),"'","''")
	  RsUseradd("City")=Replace(Trim(Request.Form("city")),"'","''")
	  RsUseradd("Address")=Replace(Trim(Request.Form("Address")),"'","''")
	  RsUseradd("UnderWrite")=Replace(Request.Form("UnderWrite"),"'","''")
	  RsUseradd("SelfIntro")=Replace(Request.Form("SelfIntro"),"'","''")
	  if Replace(Trim(Request.Form("OpenInfTF")),"'","''") = "1" then
		  RsUseradd("OpenInfTF")=true
	  else
		  RsUseradd("OpenInfTF")=false
	  end if
	  if Replace(Trim(Request.Form("SubInfTF")),"'","''") = "1" then
		  RsUseradd("SubInfTF")=true
	  else
		  RsUseradd("SubInfTF")=false
	  end if
	  RsUseradd.update
	  set RsUseradd=nothing
	Response.Write("<script>alert(""修改成功"");location=""Usermain.asp"";</script>")  
	Response.End
end if
%>
<html>
<head>
<link href="../CSS/css.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>登陆成功_会员中心</title>
</head>

<body>
<table width="700" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#999999">
  <tr> 
    <td><table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr bgcolor="#EFEFEF"> 
          <td width="26" height="32">&nbsp;</td>
          <td width="445"><b><font color="#000000"><b>登陆成功！</b></font></b></td>
          <td width="96"><div align="center"><a href="Usermain.asp">会员中心首页 </a></div></td>
          <td width="52"><div align="center"><font color="#FF0000"><a href="../Help/">帮助</a></font></div></td>
          <td width="72"><div align="center"><a href="Logout.asp"><font color="#FF0000">安全退出</font></a></div></td>
          <td width="9"></td>
        </tr>
      </table></td>
  </tr>
</table>
<br>
<table width="700" border="0" align="center" cellpadding="8" cellspacing="1" class="tabbgcolor">
  <tr> 
    <td height="315" class="tabbgcolorli"> 
      <%
	if request("action")="ChangePwd" then
	Call ChangePwd()
	elseif request("action")="Modify" then
	Call Modify()
	elseif request("action")="Other" then
	Call Other()
	else
	Call Errorcode()
	end if
	%>
      <%
sub ChangePwd()
set RsMemObj = Server.CreateObject ("ADODB.RecordSet")
RsMemObj.Source="select * from Members where ID="&Replace(Trim(Request("MemID")),"'","''")
RsMemObj.Open RsMemObj.Source,Conn,1,1
%>
      <form name="form1" method="post" action="">
        <table width="90%" border="0" align="center" cellpadding="8" cellspacing="1" bgcolor="#CECECE" class="tabbgcolor">
          <tr bgcolor="#FFFFFF" class="tabbgcolorli"> 
            <td width="37%"><div align="right">旧密码：</div></td>
            <td width="63%"><input name="OldPassword" type="password" id="OldPassword"></td>
          </tr>
          <tr bgcolor="#FFFFFF" class="tabbgcolorli"> 
            <td><div align="right">新密码：</div></td>
            <td><input name="NewPassword" type="password" id="NewPassword"></td>
          </tr>
          <tr bgcolor="#FFFFFF" class="tabbgcolorli"> 
            <td><div align="right">确认新密码：</div></td>
            <td><input name="ConfimPassword" type="password" id="ConfimPassword"></td>
          </tr>
          <tr bgcolor="#FFFFFF" class="tabbgcolorli">
            <td>&nbsp;</td>
            <td><input name="Submit" type="submit" class="Anbut" value="修改">
              <input name="Submit2" type="reset" class="Anbut" value="重置">
              <input name="action" type="hidden" id="action" value="modifychange"></td>
          </tr>
        </table>
      </form> 
<%end sub
%>
<%
sub Other()
set RsMemObj = Server.CreateObject ("ADODB.RecordSet")
RsMemObj.Source="select * from Members where ID="&Replace(Trim(Request("MemID")),"'","''")
RsMemObj.Open RsMemObj.Source,Conn,1,1
%>
      <form name="form1" method="post" action="">
        <table width="90%" border="0" align="center" cellpadding="8" cellspacing="1" bgcolor="#CECECE" class="tabbgcolor">
          <tr bgcolor="#FFFFFF" class="tabbgcolorli"> 
            <td><div align="right">问题：</div></td>
            <td><%=RsmemObj("PassQuestion")%></td>
          </tr>
          <tr bgcolor="#FFFFFF" class="tabbgcolorli"> 
            <td><div align="right">输入你的旧问题答案</div></td>
            <td><input name="PassAnswer" type="text" id="PassAnswer"></td>
          </tr>
          <tr bgcolor="#FFFFFF" class="tabbgcolorli"> 
            <td width="37%"><div align="right">新问题：</div></td>
            <td width="63%"><input name="PassQuestion" type="text" id="PassQuestion"></td>
          </tr>
          <tr bgcolor="#FFFFFF" class="tabbgcolorli"> 
            <td><div align="right">新密码答案：</div></td>
            <td><input name="PassAnswer1" type="text" id="PassAnswer1"></td>
          </tr>
          <tr bgcolor="#FFFFFF" class="tabbgcolorli">
            <td><div align="right">确认新密码答案：</div></td>
            <td><input name="ConfimPassAnswer1" type="text" id="ConfimPassAnswer1"></td>
          </tr>
          <tr bgcolor="#FFFFFF" class="tabbgcolorli"> 
            <td>&nbsp;</td>
            <td><input name="Submit3" type="submit" class="Anbut" value="修改"> 
              <input name="Submit22" type="reset" class="Anbut" value="重置"> <input name="action" type="hidden" id="action" value="anchange"></td>
          </tr>
        </table>
      </form>
      <%end sub
%>
      <%
sub Modify()
set rs=server.createobject("adodb.recordset")
      sql="select * from Members where ID="& &Replace(Trim(Request("MemID")),"'","''")
      rs.open sql,conn,1,1
%>
      <form name="form2" method="post" action="">
        <table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#CECECE">
          <tr bgcolor="#FFFFFF"> 
            <td width="27%"><div align="right">会员名：</div></td>
            <td width="73%"><%=rs("MemName")%>&nbsp;</td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td><div align="right">Email：</div></td>
            <td><input name="Email" type="text" id="MemName16" value="<%=rs("Email")%>" size="30"></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td><div align="right">电话：</div></td>
            <td><input name="Telephone" type="text" id="MemName17" value="<%=rs("Telephone")%>" size="30"></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td><div align="right">Oicq：</div></td>
            <td><input name="Oicq" type="text" id="MemName18" value="<%=rs("Oicq")%>" size="30"></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td><div align="right">HomePage：</div></td>
            <td><input name="HomePage" type="text" id="MemName19" value="<%=rs("HomePage")%>" size="30"></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td><div align="right">用户姓名：</div></td>
            <td><input name="Uname" type="text" id="MemName20" value="<%=rs("Name")%>" size="30"></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td><div align="right">登陆次数：</div></td>
            <td><%=rs("LoginNum")%></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td><div align="right">地址：</div></td>
            <td><input name="Address" type="text" id="MemName22" value="<%=rs("Address")%>" size="30"></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td><div align="right">个人介绍：</div></td>
            <td><textarea name="SelfIntro" cols="40" rows="5" id="MemName23"><%=rs("SelfIntro")%></textarea></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td><div align="right">头像：</div></td>
            <td><input name="HeadPic" type="text" id="MemName27" value="<%=rs("HeadPic")%>" size="30"></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td><div align="right">出生日期：</div></td>
            <td><input name="Birthday" type="text" id="MemName28" value="<%=rs("Birthday")%>" size="30">
              请使用时间格式，如：1977-5-5</td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td><div align="right">MSN：</div></td>
            <td><input name="MSN" type="text" id="MemName29" value="<%=rs("MSN")%>" size="30"></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td><div align="right">地区：</div></td>
            <td><input name="Corner" type="text" id="MemName30" value="<%=rs("Corner")%>" size="30"></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td><div align="right">省份：</div></td>
            <td><input name="Province" type="text" id="MemName31" value="<%=rs("Province")%>" size="30"></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td><div align="right">城市：</div></td>
            <td><input name="City" type="text" id="MemName32" value="<%=rs("City")%>" size="30"></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td><div align="right">职业：</div></td>
            <td><input name="Vocation" type="text" id="MemName33" value="<%=rs("Vocation")%>" size="30"></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td><div align="right">学历：</div></td>
            <td><input name="EduLevel" type="text" id="MemName34" value="<%=rs("EduLevel")%>" size="30"></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td><div align="right">是否开放资料：</div></td>
            <td><input type="radio" name="OpenInfTF" value="1" <%if rs("OpenInfTF")=true then response.Write("checked")%>>
              是 
              <input type="radio" name="OpenInfTF" value="0" <%if rs("OpenInfTF")=false then response.Write("checked")%>>
              否</td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td><div align="right">是否订阅本站信息：</div></td>
            <td><input type="radio" name="SubInfTF" value="1" <%if rs("SubInfTF")=true then response.Write("checked")%>>
              是 
              <input type="radio" name="SubInfTF" value="0" <%if rs("SubInfTF")=false then response.Write("checked")%>>
              否 </td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td><div align="right">签名：</div></td>
            <td><textarea name="UnderWrite" cols="40" rows="5" id="MemName37"><%=rs("UnderWrite")%></textarea></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td>&nbsp;</td>
            <td><input type="submit" name="Submit32" value="修改"> <input name="action" type="hidden" id="action3" value="usermodify"> 
              <input name="MemID" type="hidden" id="MemID" value="<%=Rs("ID")%>"></td>
          </tr>
        </table>
      </form>
      <%end sub
%>
    </td>
  </tr>
  <tr>
    <td class="tabbgcolorlileft">
<div align="center"> 
        <p class="tabbgcolorlileft">
          <%
		Dim Rsconfig
		set Rsconfig=conn.execute("select * from config")
		Response.Write(""&Rsconfig("Copyright")&"")
		Rsconfig.close
		set Rsconfig=nothing
		%>
        </p>
      </div></td>
  </tr>
</table>
</body>
</html>
<%
RsmemObj.close
set RsmemObj=nothing 
%>
