%
 dim aqn, rndaq, rsq
 aqn = 0
 rndaq = 0
 set rs = server.createobject("adodb.recordset")
 sql = "select [question] from [" & dbmunber & "aqcode]"
 rs.cursorlocation = 3
 rs.open sql, conn, 1, 1
 aqn = rs.recordcount
 if rs.recordcount > 0 then
 randomize
 rndaq = int(rs.recordcount * rnd())
 rs.move rndaq
 rsq = rs(0)
 end if
 rs.close
 set rs = nothing
 dim webparameters, t
 act = saferequest(request("act"), 0)
 t = saferequest(request("t"), 0)
 set rs = server.createobject("adodb.recordset")
 sql = "select [parameters] from [" & dbmunber & "config]"
 rs.cursorlocation = 3
 rs.open sql, conn, 1, 1
 webparameters = split(rs(0), ",")
 rs.close
 set rs = nothing
 if act = "reg" then
  dim username, password, password1, xingming, xingbie, shengfen, dizhi, dianhua, xinxiang, qq, tjr, dyzm, dquestion
  username = saferequest(request.form("username"), 0)
  password = saferequest(request.form("password"), 0)
  password1 = saferequest(request.form("password1"), 0)
  xingming = saferequest(request.form("xingming"), 0)
  xingbie = saferequest(request.form("xingbie"), 0)
  shengfen = saferequest(request.form("shengfen"), 0)
  dizhi = saferequest(request.form("dizhi"), 0)
  dianhua = saferequest(request.form("dianhua"), 0)
  xinxiang = saferequest(request.form("xinxiang"), 0)
  dyzm = saferequest(request.form("yzm"), 0)
  dquestion = saferequest(request.form("question"), 0)
  qq = saferequest(request.form("qq"), 1)
  tjr = saferequest(request.form("tjr"), 0)
  if len(username) < 3 or len(username) > 20 then call msgbox("登錄帳號長度為3-20位!", "reg.asp")
  if checkstring(username, "([%]|[?]|[=]|[/]|[\\]|[*]|[ ]|[+]|[<]|[>]|[{]|[}]|[&]|[']$)") = true then call msgbox("登錄帳號中不允許使用非法字符。", "reg.asp")
  if len(password) < 1 then call msgbox("請?zhí)顚懙卿浢艽a!", "reg.asp")
  if password <> password1 then call msgbox("兩次輸入的密碼不一致,請重新輸入。", "-1")
  if len(xingming) < 1 then call msgbox("請?zhí)顚懻鎸嵭彰?, "reg.asp")
  if len(xingbie) < 1 then call msgbox("請選擇性別!", "reg.asp")
  if len(shengfen) < 1 then call msgbox("請選擇所在省份!", "reg.asp")
  if len(dianhua) < 1 then call msgbox("請?zhí)韺懧?lián)系電話!", "reg.asp")
  if dianhua <> "" then
   if checkstring(dianhua, "(^[0-9]{3,4}\-[0-9]{7,8}$)|(^[0-9]{3,4}[0-9]{7,8}$)|(^[1-9]{1,1}[0-9]{6,7}$)") = false and checkstring(dianhua, "(^(13|15|18)[0-9]{9}$)") = false then  call msgbox("電話的格式不正確。", "reg.asp")
   if (left(dianhua, 5) = "12590" or left(dianhua, 3) = "168") then call msgbox("不允許使用特別服務(wù)號碼。", "-1")
  end if
  if xinxiang <> "" and checkstring(xinxiang, "^([a-zA-Z0-9_-])+@([\.a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,6}){1,2})$") = false then call msgbox("電子信箱格式不正確。", "reg.asp")
  if qq <> "" and checkstring(qq, "(^[1-9]{1,1}[0-9]{4,9}$)") = false then call msgbox("騰訊QQ的格式不正確。", "-1")
  if qq <> "" and qq = "10000" then call msgbox("不允許使用系統(tǒng)服務(wù)號碼。", "reg.asp")
  if aqn > 0 then
  if dquestion = "" or dyzm = "" then call msgbox("非法的提交操作。", "index.asp")
  set rs = server.createobject("adodb.recordset")
  sql = "select [answer] from [" & dbmunber & "aqcode] where [question] = '" & dquestion & "'"
  rs.cursorlocation = 3
  rs.open sql, conn, 1, 1
  if rs.recordcount = 0 then call msgbox("非法的提交操作。", "index.asp")
  if md5(dyzm) <> md5(rs(0)) then call msgbox("驗證答案輸入不正確。", "-1")
  end if
  set rs = server.createobject("adodb.recordset")
  sql = "select [username], [password], [name], [sex], [province], [address], [tel], [email], [qq], [time], [ip], [lock], [type], [lv], [pay], [loginnumber], [exp], [logintime], [loginip], [tjren] from [" & dbmunber & "member] where [username] = '" & username & "'"
  rs.cursorlocation = 3
  rs.open sql, conn, 1, 3
  if rs.recordcount = 0 then
   rs.addnew
   rs(0) = username
   rs(1) = md5(password)
   rs(2) = xingming
   rs(3) = xingbie
   rs(4) = shengfen
   rs(5) = dizhi
   rs(6) = dianhua
   rs(7) = xinxiang
   rs(8) = qq
   rs(9) = now()
   rs(10) = myip
   if webparameters(0) = 1 then
   rs(11) = true
   else
   rs(11) = false
   end if
   rs(12) = "普通用戶"
   rs(13) = 0
   rs(14) = 0
   rs(15) = 0
   rs(16) = 0
   rs(17) = now()
   rs(18) = myip
   rs(19) = tjr
   rs.update
   if xinxiang <> "" then
    dim temp_t, temp_b
    temp_t = "用戶注冊信息"
    temp_b = "尊敬的用戶:恭喜您!注冊成功!
登錄帳號:" & username & "
登錄密碼:" & password & "
" & ename & "免費發(fā)布各類供求信息!
網(wǎng)址:" & eurl & "
電話:" & eservicetel & "
QQ:" & eserviceqq & " (點擊交談)
"
    call smtpmail(xinxiang, temp_t, temp_b)
   end if
   call msgbox("恭喜,注冊成功!", "userlogin.asp")
  else
   call msgbox("提示\n此帳號已被注冊,請換別的吧!", "reg.asp")
  end if
  rs.close
  set rs = nothing
 end if
%>