<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Include/conn.asp"-->
<!--#include file="../Include/ConnDatabase.asp"-->
<%
'=====================================
'天天企业网站管理系统  TianTianCMS
'天天网络科技工作室版权所有
'官方网站http://www.ip126.com
'技术支持论坛 http://bbs.ip126.com/
'QQ:530051328 mail:bbfhq@163.com
'=====================================
%>
<%Response.Charset="utf-8"%>

<%
dim ID,mRealName,mSex,mPassword,vPassword,mCompany,mAddress,mZipCode,mTelephone,mFax,mMobile,muserqq,mEmail,mHomePage
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"))
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"))
If request.form("GetCode")<>"" Then GetCode = Int(Trim(request.form("GetCode")))
dim ErrMessage,ErrMsg(9),FindErr(9),i
  ErrMsg(0)="·Your password must contain 6 - 16 characters."
  ErrMsg(1)="·Your password wasn't contifrmed."
  ErrMsg(2)="·Your company/address must contain 0 - 100 characters."
  ErrMsg(3)="·Your Zip/Postal Code must contain 0 - 20 characters."
  ErrMsg(4)="·Your name/tel/fax/mobile/website must contain 0 - 50 characters."
  ErrMsg(5)="·Please enter a valid email address."
  ErrMsg(6)="·This email is already registered."
  ErrMsg(7)="·Please enter the number in the image."
  ErrMsg(8)="·Time that you stop over in the 【 Edit my registry 】 page over long, cause verify the code the expiration.\ the n pleases return and break the 【 Edit my registry 】 page to order afresh!"
  ErrMsg(9)="·Verifying the code can not for getting empty please return the check."


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(mMobile)=0 then FindErr(4)=true
if not IsValidEmail(mEmail) then FindErr(5)=true
if not conn.execute("select MemName from TianTianCMS_Members where ID<>"&ID&" and Email='" & mEmail & "'").eof then FindErr(6)=True
If Trim(request.form("GetCode"))= "" Then FindErr(7)=true
If Trim(Session("GetCode")) = "" Then FindErr(8)=true
If GetCode <> Session("GetCode") 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 TianTianCMS_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("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('Congratulations, Your account has been changed！');location.replace('MemberInfo.asp');</script>"
%>
