<!--#include file="Include/Const.Asp"-->
<!--#include file="Include/NoSQL.Asp" -->
<!--#include file="Include/ConnSiteData.Asp"-->
<!--#include file="Include/Md5.Asp"-->
<%
Dim ID, mRealName, mSex, mPassword, vPassword, mCompany, mAddress, mZipCode, mTelephone, mFax, mMobile, mEmail, mHomePage
Dim CheckCode
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"))
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"))
mEmail = Trim(request.Form("Email"))
mHomePage = Trim(request.Form("HomePage"))
CheckCode = Trim(request.Form("CheckCode"))
Dim ErrMessage, ErrMsg(9), FindErr(9), 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) = "您输入的验证码和系统产生的不一致，请重新输入。"
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(mCompany) = 0 Or Len(mCompany)>100 Or Len(mAddress) = 0 Or Len(mAddress)>100 Then FindErr(2) = True
If Len(mZipCode)<>6 Then FindErr(3) = True
If Len(mRealName) = 0 Or Len(mTelephone) = 0 Or Len(mFax) = 0 Or Len(mMobile) = 0 Or Len(mHomePage) = 0 Or Len(mRealName)>50 Or Len(mTelephone)>50 Or Len(mFax)>50 Or Len(mMobile)>50 Or Len(mHomePage)>50 Then FindErr(4) = True
If Not IsValidEmail(mEmail) Then FindErr(5) = True
If Not conn.Execute("select MemName from Shenbi_Members where ID<>"&ID&" and Email='" & mEmail & "'").EOF Then FindErr(6) = True
If CheckCode = "" Then FindErr(7) = True
If Trim(Session("CheckCode")) = "" Then FindErr(8) = True
If CheckCode <> 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 Shenbi_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)
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("Email") = mEmail
rs("HomePage") = StrReplace(mHomePage)
rs.update
rs.Close
Set rs = Nothing
response.Write "<script language='javascript'>alert('会员资料修改成功，即将返回到会员中心！');location.replace('MemberInfo.Asp');</script>"
%>