<!--#include file="Inc.asp"-->
<!--#include file="forbbs.asp"-->
<!--#include VIRTUAL="/Inc/chinahanzi.asp"-->
<!--#include file="../md5.asp"-->
<!--#include file="ydzq.asp"-->
<%call head()
call saycardd("注册会员")
dim sjhm,username,pass,sex,zcip,email,TP
sjhm=usb(request("sjhm"))
username=forbbs(request("username"))
pass=usb(request("pass"))
email=usb(request("email"))
sex=usb(request("sex"))
TP=usb(request("TP"))
zcip=Request.ServerVariables("REMOTE_ADDR")
if TP<>"" then

if sjhm="" or pass="" or username="" then
    Call Error("请填写完整！")
  end if

if len(username) > 10 then
  Call Error("会员昵称不能超过10个字！")
end if

if Instr(username,"爷") or Instr(username,"奶") or Instr(username,"爸") or Instr(username,"妈") or Instr(username,"爹") then
  Call Error("系统限制昵称“"&username&"”，请重新输入！")
end if
'过滤昵称
dim h
for h = 1 to len(username)
  if Instr(chinahanzi,mid(username,h,1))=0 then
  Call Error("会员昵称只能是汉字、字母、数字组成！")
  end if
next

if ifbadchr("abcdefghijklmnopqrstuvwxyz0123456789",pass) > 0 or len(pass) < 4 or len(pass) > 15 then

 Call Error("密码必须是4至15位的英文小写字母或数字的组合！")
  end if

if Isnumeric(sjhm)=false then 
    Call Error("请输入正确的手机号！")
  end if
if len(sjhm)<>11 then 
    Call Error("请输入正确的手机号！")
  end if
if left(sjhm,2)<>13 and left(sjhm,2)<>15 then 
    Call Error("请输入正确的手机号！")
  end if
set rs=Server.CreateObject("ADODB.Recordset")
  rs.open"select name from [Users] where [name]='"&username&"'",conn,1,1
if not rs.eof then
rs.close
set rs=nothing
    Call Error("该昵称已经被使用！")
  end if
rs.close
set rs=nothing
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select sjhm from [Users] where [sjhm]='"&sjhm&"'",conn,1,1
if not rs.eof then
rs.close
set rs=nothing
    Call Error("该该手机号已经被使用！")
  end if
rs.close
set rs=nothing

dim siddd
Function SID_RANDOMIZE()
Dim c,id
randomize 
c="a,A,1,b,B,2,c,C,3,d,D,4,e,E,5,f,F,6,g,G,7,h,H,8,i,I,9,j,J,0,k,K,1,l,L,2,m,M,3,n,N,4,o,O,5,p,P,6,q,Q,7,r,R,8,s,S,9,t,T,0,u,v,w,x,y,z,"
id=split(c,",") 
for i=1 to 10
SID_RANDOMIZE=int(rnd()*36)&SID_RANDOMIZE
Next
SID_RANDOMIZE=SID_RANDOMIZE&minute(now)&second(now)&day(now)&month(now)
End Function
siddd=md5(md5(sjhm+SID_RANDOMIZE,16),32)

set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select * from [Users]",conn,1,2
rs.addnew
rs("sjhm")=sjhm
rs("mm")=pass
rs("sex")=3
rs("name")=username
rs("myip")=zcip
rs("myjb")=regjb
rs("regtime")=now()
rs("listnum")=8
rs("viewnum")=500
rs("review")=3
rs("relistnum")=8
rs.update
rs.close
set rs=nothing
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select top 1 id from [Users] order by id desc",conn,1,1
sidd=rs("id")&"_"&siddd
conn.Execute("update Users set sid='"&sidd&"' Where id="&rs("id"))
response.write"注册成功，您的ＩＤ:"&rs("id")
response.write"用户密码为"&pass
rs.close
set rs=nothing
conn.close
set conn=nothing
else
if saytk>1 then
Response.write "<form name=""form"" method=""post"" action=""reg.asp?sid="&sid&"&amp;saytk="&saytk&""">"
end if%>
手机号码<br/><input name="sjhm" title="手机号：" type="text" format="*M" emptyok="true" maxlength="11" value=""/><br/>
登录密码<br/><input name="pass" title="登陆密码" type="text" format="*M" emptyok="true" maxlength="500" value=""/><br/>
会员昵称<br/><input name="username" title="昵称" type="text" format="*M" emptyok="true" maxlength="500" value=""/><br/>
<%if saytk>1 then
response.write "<input type=""hidden"" name=""tp"" value=""ok""/>"
response.write "<input type=""submit"" name=""Submit"" value=""提交注册""></form><br/>"
else%>
<anchor>提交注册
<go href="reg.asp?sid=<%=sid%>&amp;saytk=<%=saytk%>" method="post" accept-charset="utf-8">
<postfield name="sjhm" value="$(sjhm)"/>
<postfield name="pass" value="$(pass)"/>
<postfield name="username" value="$(username)"/>
<postfield name="email" value="$(email)"/>
<postfield name="TP" value="ok"/>
</go></anchor>
<%end if
end if
response.write"<br/><a href='adminpst.asp?sid="&sid&"&amp;saytk="&saytk&"'>会员管理</a>"
%><!--#include file="fanhui.asp"-->
<%response.write""
call headsay()%>
