📄 reg_send.asp
字号:
<!--插入html头部分以及数据库接口-->
<!--#include file="in_conn.asp"-->
<!--#include file="inc/md5.asp"-->
<!--#include file="UpLoadClass.asp"-->
<%
Server.ScriptTimeOut=5000
dim request2
'建立上传对象
set request2=New UpLoadClass
'使用手动方式保存
request2.AutoSave=2
request2.SavePath="face/upface/"
'打开对象
request2.open()
'判断用户名格式的函数
FUNCTION userstr(stru)
dim i,aa
dim istr
For i=1 To Len(stru)
istr=mid(stru,i,1)
aa=ASC(istr)
If aa>31 AND aa<48 Then
userstr=False
Exit For
Elseif aa>57 AND aa<65 Then
userstr=False
Exit For
Elseif aa>90 AND aa<95 Then
userstr=False
Exit For
Elseif aa>95 AND aa<97 Then
userstr=False
Exit For
Else
userstr=True
End if
Next
END FUNCTION
'判断邮件格式是否正确
Function isEmail(strng)
Dim regEx,regVal
Set regEx=New RegExp
regEx.Pattern="^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$"
regEx.IgnoreCase=True
isEmail=regEx.Test(strng)
End Function
dim vname,vpwd,vrepwd,vemail,vhome,vnowdo,vcontact,vface,vsign
dim vsex,vqq,vhometel,vmob,vy,vm,vd,vfacew,vfaceh
dim vbirth,vdate
'获得表单传值
vname=trim(Request2.Form("txtname"))
vpwd=trim(Request2.Form("txtpwd"))
vrepwd=trim(Request2.Form("txtrepwd"))
vemail=trim(Request2.Form("txtemail"))
vhome=trim(Request2.Form("txthome"))
vnowdo=trim(Request2.Form("txtdo"))
vcontact=trim(Request2.Form("txtcontact"))
vsign=trim(Request2.Form("txtsign"))
vmsn=trim(Request2.Form("txtmsn"))
vhp=trim(Request2.Form("txthp"))
if Request2.Form("radsex")="gg" then
vsex=1
else
vsex=0
end if
vqq=trim(Request2.Form("txtqq"))
vhometel=trim(Request2.Form("txthometel"))
vmob=trim(Request2.Form("txtmobile"))
vy=Request2.Form("syear")
vm=Request2.Form("smonth")
vd=Request2.Form("sday")
vdate=now()
'检查正确性
If userstr(vname)=False or vname="" Then
Response.Redirect "resp.asp?cmd=uname_err"
ElseIf isEmail(vemail)=False or vemail="" Then
Response.Redirect "resp.asp?cmd=uemail_err"
ElseIF vmsn<>"" AND isEmail(vmsn)=False Then
Response.Redirect "resp.asp?cmd=uemail_err"
ElseIf Len(vpwd)<6 OR Len(vpwd)>14 Then
Response.Redirect "resp.asp?cmd=upwd_len"
ElseIf vpwd<>vrepwd Then
Response.Redirect "resp.asp?cmd=urepwd_err"
ElseIf vcontact<>"" And Len(vcontact)>150 Then
Response.Redirect "resp.asp?cmd=ucontact_len"
ElseIf vsign<>"" And Len(vsign)>255 Then
Response.Redirect "resp.asp?cmd=usign_len"
ElseIf vqq<>"" And isnumeric(vqq)=False Then
Response.Redirect "resp.asp?cmd=uqq_num"
End If
'检查是否重复注册
sqlstr="SELECT ID FROM tblmates WHERE name='"&vname&"'"
rs.open sqlstr,conn,1,1
if NOT(rs.eof AND rs.bof) then
Response.Redirect "resp.asp?cmd=ureg_2"
end if
rs.close
IF Request2.Form("radface")="up" THEN
Request2.MaxSize=102400
if Request2.Save("strFace",0) then
'如果上传成功
vface=Request2.SavePath&Request2.Form("strFace")
vfacew=Request2.Form("strFace_Width")
vfaceh=Request2.Form("strFace_Height")
if isNumeric(vfacew) then
If vfacew>150 or vfaceh>150 Then
'如果图片宽高不符界限,则
if vfacew>vfaceh then
vfaceh=Cint(150 / vfacew * vfaceh)
vfacew=150
else
vfacew=Cint(150 / vfaceh * vfacew)
vfaceh=150
end if
End If
else
vfacew=150
vfaceh=150
end if
else
'如果上传失败
Response.Redirect "resp.asp?cmd=uface_up"
end if
Else
vface="face/"&Request2.Form("sface")&".gif"
vfacew=42
vfaceh=85
END IF
vy=Request2.Form("syear")
vm=Request2.Form("smonth")
vd=Request2.Form("sday")
if isDate(vy&"-"&vm&"-"&vd) then
vbirth=CDate(vy&"-"&vm&"-"&vd)
else
Response.Redirect "resp.asp?cmd=ubirth_day"
end if
set request2=Nothing
'MD5加密
vpwd=md5(vpwd,32)
'开始插入数据
sqlstr="INSERT INTO tblmates(name,pwd,sex,email,qq,home,hometel,mobile,nowdo,contact,birthday,birthm,regdate,lastlog,power,faceurl,facew,faceh,cnt_water,cnt_on,signline,myfj,msn,hp) VALUES('"&stryin(vname)&"','"&stryin(vpwd)&"',"&vsex&",'"&stryin(vemail)&"','"&stryin(vqq)&"','"&stryin(vhome)&"','"&stryin(vhometel)&"','"&stryin(vmob)&"','"&stryin(vnowdo)&"','"&stryin(vcontact)&"',#"&vbirth&"#,"&vm&",#"&vdate&"#,#"&vdate&"#,0,'"&stryin(vface)&"',"&vfacew&","&vfaceh&",0,1,'"&stryin(vsign)&"',0,'"&stryin(vmsn)&"','"&stryin(vhp)&"')"
conn.Execute sqlstr
IF DEF_mb_chk=0 THEN
sqlstr="UPDATE tblmates SET power=1,regdate=#"&now()&"# WHERE name='"&stryin(vname)&"'"
conn.Execute sqlstr
END IF
Session("sname")=vname
Response.Redirect "rego.asp?cmd=reg_ok"
%>
<body>
<!--插入网站置底-->
<!--#include file="in_bottom.asp"-->
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -