<!--#include file="../Include/Const.asp"-->
<!--#include file="../Include/ConnSiteData.asp"-->
<%
if DateDiff("s",session("time"),now())<Refresh then
   response.write "<script language='JavaScript'>alert('防刷新机制启动：请不要在 "&Refresh&" 秒内重复刷新！');" & "history.back()" & "</script>"
   response.end
else
   session("time")=now()
end if
dim mMemName,mRealName,mSex,mPassword,mQuestion,mAnswer,mCompany,mAddress,mZipCode,mTelephone,mFax,mMobile,mEmail,mHomePage
dim vPassword,CheckCode
dim rs,sql
mMemName=trim(request.form("MemName"))
mRealName=trim(request.form("RealName"))
mSex=trim(request.form("Sex"))
mPassword=trim(request.form("Password"))
vPassword=trim(request.form("vPassword"))
mQuestion=trim(request.form("Question"))
mAnswer=trim(request.form("Answer"))
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(13),FindErr(13),i
  ErrMsg(0)="用户名必须为0-9,a-z,-_任意组合的3-16个字符。"
  ErrMsg(1)="用户名重复，请返回修改。"
  ErrMsg(2)="用户密码长度请保持在6-16位。"
  ErrMsg(3)="两次输入的用户密码不一致，请返回修改。"
  ErrMsg(4)="密码保护问题长度请保持在3-100个任何字符。"
  ErrMsg(5)="密码保护答案长度请保持在3-100个任何字符。"
  ErrMsg(6)="单位名称、详细地址长度请保持在100个字符以内。"
  ErrMsg(7)="请正确填写邮政编码。"
  ErrMsg(8)="请正确填写真实姓名、联系电话、传真号码、手机号码、网址。"
  ErrMsg(9)="电子信箱格式错误。"
  ErrMsg(10)="电子信箱已经注册过，请返回修改。"
  ErrMsg(11)="验证码不能为空，请返回检查。"
  ErrMsg(12)="您在【会员注册】页面停留的时间过长，导致验证码失效。\n请返回并刷新【会员注册】页面重新注册！"
  ErrMsg(13)="您输入的验证码和系统产生的不一致，请重新输入。"
if not IsValidMemName(mMemName) then FindErr(0)=true
if not conn.execute("select MemName from wygkcndiv_Members where MemName='" & mMemName & "'").eof then FindErr(1)=true
if not (6<=len(mPassword) and len(mPassword)<=16) then FindErr(2)=true
if mPassword<>vPassword then FindErr(3)=true
if not (3<=len(mQuestion) and len(mQuestion)<=100) then FindErr(4)=true
if not (3<=len(mAnswer) and len(mAnswer)<=100) then FindErr(5)=true
if len(mCompany)=0 Or len(mCompany)>100 Or len(mAddress)=0 Or len(mAddress)>100 then FindErr(6)=true
if len(mZipCode)<>6 then FindErr(7)=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(8)=true
if not IsValidEmail(mEmail) then FindErr(9)=true
if not conn.execute("select MemName from wygkcndiv_Members where Email='" & Email & "'").eof then FindErr(10)=True
If CheckCode = "" Then FindErr(11)=true
If Trim(Session("CheckCode")) = "" Then FindErr(12)=true
If CheckCode <> Session("CheckCode") Then FindErr(13)=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 wygkcndiv_Members"
rs.open sql,conn,1,3
rs.addnew
rs("MemName")=mMemName
rs("RealName")=StrReplace(mRealName)
rs("Sex")=mSex
rs("Password")=Md5(mPassword)
rs("Question")=StrReplace(mQuestion)
rs("Answer")=Md5(mAnswer)
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("GroupID")="200709088888888888"
rs("GroupName")=GroupName("200709088888888888")
rs("AddTime")=now()
rs.update
rs.close
Set rs=Nothing
response.write "<script language='javascript'>alert('注册成功，请登录！');location.replace('Index.asp');</script>"
response.End

function GroupName(GroupID)
  dim rs,sql
  set rs = server.createobject("adodb.recordset")
  sql="select * from wygkcndiv_MemGroup where GroupID='"&GroupID&"'"
  rs.open sql,conn,1,1
  GroupNameCH=rs("GroupName"&Language)
  rs.close
  set rs=nothing
end function
%>