<%case"agree"%>
<%case"save"%><%
dim name,password,repassword,email,sex,burn1,burn2,burn3,burn,home,qq,gxqm,picw,pich,bbspic,mypic,toupic
dim canreg,badwords,z,adminid,sickpass,userinfo,regtime,sql,userid,newuserinfo,bad,b
function checkbad(str)
if isnull(str) then exit function
bad=split(application(prefix&"badcontent"), "|")
for b=0 to ubound(bad)
str=Replace(str,bad(b),string(len(bad(b)),"*"))
next
checkbad=str
end function
name=Replace(Request.Form("name"),"'","''")
password=Replace(Request.Form("password"),"'","''")
repassword=Replace(Request.Form("repassword")," ","")
email=Replace(Request.Form("email"),"'","''")
adminid=Replace(Request.Form("adminid"),"'","''")
sex=checknum(request.form("sex"))
burn1=replace(Request.Form("burn1"),"'","")
burn2=replace(Request.Form("burn2"),"'","")
burn3=replace(Request.Form("burn3"),"'","")
home=Replace(Request.Form("home"),"'","''")
home=ubbg(home)
qq=Replace(Request.Form("qq"),"'","''")
gxqm=Request.Form("gxqm")
gxqm=Replace(left(gxqm,255),"'","''")
gxqm=replace(gxqm,"|","│")
gxqm=checkbad(gxqm)
picw=Replace(Request.Form("picw"),"'","''")
pich=Replace(Request.Form("pich"),"'","''")
mypic=Replace(Request.Form("mypic"),"'","''")
mypic=ubbg(mypic)
bbspic=Replace(Request.Form("bbspic"),"'","''")
canreg=true
function checkStr(str)
if isnull(str) then
checkStr = ""
exit function
end if
checkStr=replace(str,"'","''")
end function
if name="" or password="" or repassword="" or email="" or adminid="" or sex="" then
canreg=false
mes="·请填写完整必填的资料。 "
else
mes=""
if strlength(name)>16 then
canreg=false
mes="·你的用户名长度超过了16。 "
end if
if not pass_name(name) then
canreg=false
mes=mes&"·你的用户名含有非法字符。 "
end if
badwords=split(application(prefix&"badwords"),"|")
for z=0 to ubound(badwords)
if instr(name,badwords(z))>0 then
canreg=false
mes=mes&"·你的用户名含有论坛禁止使用的字词。 "
exit for
end if
next
if canreg=true then
if not conn.execute("select top 1 userid from [user] where name='"&name&"'").eof then canreg=false:mes=mes&"·该用户名已经被注册了。 "
end if
if len(password)>16 then canreg=false : mes=mes&"·你填写的密码长度超过了16。 "
sickpass=array(123,1234,12345,123456,1234567,12345678,"aaa",111)
for i=0 to ubound(sickpass)
if len(password)<3 or password=sickpass(i) then
canreg=false
mes=mes&"·你的密码属于弱口令,请更换密码。 "
exit for
end if
next
'限制用户名密码不能相同
if password=name then
canreg=false
mes=mes&"·你的密码属于弱口令,请更换密码。 "
end if
'结束
if repassword<>password then canreg=false : mes=mes&"·你两次输入的密码不一样。 "
email=server.HTMLEncode(email)
if not IsValidEmail(email) then canreg=false : mes=mes&"·你的E-mail填写错误。 "
if session("adminid")<>adminid or not isnumeric(session("adminid")) then canreg=false:mes=mes&"·你输入的验证码错误。 "
end if
burn=burn1&"-"&burn2&"-"&burn3
if not isdate(burn) then burn="--"
if qq<>"" and (not isnumeric(qq) or (len(qq)<5 or len(qq)>12)) then canreg=false:mes=mes&"·你的 QQ 号码填写错误。 "
if mypic="" then
toupic="headpic/"&bbspic&".gif|"&checknum(application(prefix&"autopicw"))&"|"&checknum(application(prefix&"autopich"))
else
if picw<>"" and checknum(picw)<=checknum(application(prefix&"picw")) and pich<>"" and checknum(pich)<=checknum(application(prefix&"pich")) then
toupic=mypic&"|"&picw&"|"&pich
else
canreg=false
mes=mes&"·你的头像大小设置错误。 "
end if
end if
if checknum(application(prefix&"headpicset"))<>1 and instr(toupic,"://")>0 then
canreg=false
mes=mes&"·本论坛不允许使用外部头像。 "
end if
if canreg=false then
tl=" 注 册 失 败"
mes="对不起!你不能成功地注册用户,可能存在以下问题。 "&mes&"· 返回重新填写。"
elseif canreg=true then
tl=" 注 册 成 功"
mes="恭喜你!"&kbbs(name)&" 注册成功。 ·现在登陆论坛。 ·进入论坛首页。"%>
<%
regtime=FormatDateTime(now+timeset/24,2)
userinfo=email&"|"&home&"|"&burn&"|"&qq&"|"&sex&"|"&toupic&"|"&gxqm&"|"®time&"|"
password=md5(password)
set rs = Server.CreateObject("ADODB.Recordset")
sql="select top 1 userid,name,password,userinfo,lasttime from [user]"
rs.open sql,conn,0,2
rs.addnew
rs("name")=name
rs("password")=password
rs("userinfo")=userinfo
rs("lasttime")=regtime
rs.update
userid=rs("userid")
rs.close
set rs=nothing
newuserinfo=userid&"|"&name
conn.execute("update [config] set newuser='"&newuserinfo&"',usernum=usernum+1")
end if
call sendinfo(tl,mes)
%>
<%end select
call down
%>