<!--#include file="../Include/Const.Asp" -->
<!--#include file="../Include/Bk_safe.Asp" -->
<!--#include file="../Include/ConnDatabase.asp" -->
<!--#include file="../Include/Md5.Asp"-->
<%
'*********************************************
'软件名称：博科企业网站内容管理系统（BOKECMS）
'软件开发：博科网络科技工作室
'网    址：http://www.bokew.net
'服务  QQ：530051328
'服务邮箱：bbfhq@163.com
'微信公众号：bokewlkj
'*********************************************
%>
<%Response.Charset="utf-8"%>
<%
dim ID,mRealName,mSex,mPassword,vPassword,mCompany,mAddress,mZipCode,mTelephone,mFax,mMobile,muserqq,mEmail,mHomePage,mPayPassword,vPayPassword
dim GetCode
dim rs,sql
ID=request.QueryString("ID")
mRealName=trim(request.form("RealName"))
mSex=trim(request.form("Sex"))
mPassword=trim(request.form("Password"))
vPassword=trim(request.form("vPassword"))
mPayPassword=trim(request.form("PayPassword"))
vPayPassword=trim(request.form("vPayPassword"))
mCompany=trim(request.form("Company"))
mAddress=trim(request.form("Address"))
mZipCode=trim(request.form("ZipCode"))
mTelephone=trim(request.form("Telephone"))
mFax=trim(request.form("Fax"))
mMobile=trim(request.form("Mobile"))
muserqq=trim(request.form("userqq"))
mEmail=trim(request.form("Email"))
mHomePage=trim(request.form("HomePage"))
GetCode = Trim(request.form("GetCode"))

dim ErrMessage,ErrMsg(11),FindErr(11),i
  ErrMsg(0)="用户密码长度请保持在6-16位。"
  ErrMsg(1)="两次输入的用户密码不一致，请返回修改。"
  ErrMsg(2)="单位名称、详细地址长度请保持在100个字符以内。"
  ErrMsg(3)="请正确填写邮政编码。"
  ErrMsg(4)="请正确填写手机号码。"
  ErrMsg(5)="电子信箱格式错误。"
  ErrMsg(6)="电子信箱已经注册过，请返回修改。"
  ErrMsg(7)="验证码不能为空，请返回检查。"
  ErrMsg(8)="您在【修改会员资料】页面停留的时间过长，导致验证码失效。\n请返回并刷新【修改会员资料】页面重新修改！"
  ErrMsg(9)="您输入的验证码和系统产生的不一致，请重新输入。"
  ErrMsg(10)="钱包支付密码长度请保持在6-16位。"
  ErrMsg(11)="两次输入的钱包支付密码不一致，请返回修改。"
if len(mPassword)>0 then
   if not (6<=len(mPassword) and len(mPassword)<=16) then FindErr(0)=true
   if mPassword<>vPassword then FindErr(1)=true
end if
if len(mPayPassword)>0 then
   if not (6<=len(mPayPassword) and len(mPayPassword)<=16) then FindErr(10)=true
   if mPayPassword<>vPayPassword then FindErr(11)=true
end if
if len(mMobile)=0 then FindErr(4)=true
if not IsValidEmail(mEmail) then FindErr(5)=true
if not conn.execute("select MemName from BokeCMS_Members where ID<>"&ID&" and Email='" & mEmail & "'").eof then FindErr(6)=True
If Trim(request.form("GetCode"))= "" Then FindErr(7)=true
If Trim(Session("CheckCode")) = "" Then FindErr(8)=true
If GetCode <> Session("CheckCode") Then FindErr(9)=true
for i = 0 to UBound(FindErr)
  if FindErr(i)=true then
    ErrMessage=ErrMessage+ErrMsg(i)+"\n"
  end if
next
if not (ErrMessage="" Or isnull(ErrMessage)) then
  WriteMsg(ErrMessage)
  response.end
end if
set rs = server.createobject("adodb.recordset")
sql="select * from BokeCMS_Members where ID="&ID
rs.open sql,conn,1,3
rs("RealName")=StrReplace(mRealName)
rs("Sex")=mSex
if len(mPassword)>0 then rs("Password")=Md5(mPassword)
if len(mPayPassword)>0 then rs("PayPassword")=Md5(mPayPassword)
rs("Company")=StrReplace(mCompany)
rs("Address")=StrReplace(mAddress)
rs("ZipCode")=StrReplace(mZipCode)
rs("Telephone")=StrReplace(mTelephone)
rs("Fax")=StrReplace(mFax)
rs("Mobile")=StrReplace(mMobile)
rs("userqq")=muserqq
rs("Email")=mEmail
rs("HomePage")=StrReplace(mHomePage)
If request.form("Question")<>"" Then rs("Question")=trim(request.form("Question"))
If request.form("Answer")<>"" Then rs("Answer")=Md5(trim(request.form("Answer")))
rs.update
rs.close
set rs=nothing
response.write "<script language='javascript'>alert('会员资料修改成功，即将返回到会员中心！');location.replace('user_MemberInfo.Asp');</script>"

'*************************************************
'函数名：WriteMsg
'作  用：信息提示
'参  数：Message --提示内容
'*************************************************
function WriteMsg(Message)
  response.write "<script language='JavaScript'>alert('"&Message&"');" & "history.back()" & "</script>"
end Function%>
