|
发表于 2006-6-23 22:03:58
|
显示全部楼层
这是我的一个在某网络公司工作的朋友的,我觉得考虑得差不多了
<!--#include virtual="/inc/config.asp"-->
<!--#include virtual="/inc/Ubb.asp"-->
<%
'获取上页传输的注册信息
'定义变量
dim UBI_mail,UBI_name,UBI_psw,UBI_QU,UBI_AS,UBI_CD'定义必填信息的变量
dim UBI_sex,UBI_GJ,UBI_sheng,UBI_City,UBI_Add'定义地址信息变量
dim UBI_Tel_1,UBI_Tel_2,UBI_Tel_3,UBI_Tel_4'电话变量
dim UBI_Fax_1,UBI_Fax_2,UBI_Fax_3,UBI_Fax_4'传真变量
dim UBI_Moble,UBI_IM_No,UBI_IM_Type,UBI_Url,UBI_RegErr'其他联系信息变量
'验证是否外部提交(以是否同意注册协议为标准)
if trim(request("reg_protocol"))="ok" then
'检验用户是否已经登陆,如果登陆过将不允许注册
if session("Userlogin")<>"" then
Response.Write "<script>alert('您已经是拥有红殿通行证了!');window.location='index.asp';</script>"
else
'※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
'检验数据输入的合法性
UBI_RegErr=False
UBI_mail=trim(request("UBI_mail"))
UBI_name=ReplaceTag(trim(request("UBI_name")))
UBI_psw=ReplaceTag(trim(request("UBI_psw")))
UBI_QU=ReplaceTag(trim(request("UBI_QU")))
UBI_AS=ReplaceTag(trim(request("UBI_AS")))
UBI_CD=ReplaceTag(trim(request("UBI_CD")))
'根据上面的验证来确定下面的信息显示及执行的程序
if (mail_CHK(UBI_mail)=True) or (len(UBI_name)<3) or (len(UBI_psw)<6) or (len(UBI_psw)>16) or (UBI_psw<>trim(request("UBI_psw1"))) or (len(UBI_QU)<6) or (len(UBI_QU)>16) or (len(UBI_AS)<6) or (len(UBI_AS)>16) or (Isnumeric(UBI_CD)=False) or (len(UBI_CD)<>18) then UBI_RegErr=True
if UBI_RegErr=True then
Response.Write "<script>alert('想非法入侵?点确定以便我们的木马自动执行,点取消放弃!');window.location='index.asp';</script>"
else
'检验其他数据的正确性
if ReplaceTag(trim(request("UBI_sex")))<>"1" or ReplaceTag(trim(request("UBI_sex")))<>"2" then
UBI_sex="0"
else
UBI_sex=ReplaceTag(trim(request("UBI_sex")))
end if
UBI_GJ=ReplaceTag(trim(request("UBI_GJ")))
UBI_sheng=ReplaceTag(trim(request("UBI_sheng")))
UBI_City=ReplaceTag(trim(request("UBI_City")))
UBI_Add=ReplaceTag(trim(request("UBI_Add")))
UBI_Tel_1=ReplaceTag(trim(request("UBI_Tel_1")))
UBI_Tel_2=ReplaceTag(trim(request("UBI_Tel_2")))
UBI_Tel_3=ReplaceTag(trim(request("UBI_Tel_3")))
UBI_Tel_4=ReplaceTag(trim(request("UBI_Tel_4")))
UBI_Fax_1=ReplaceTag(trim(request("UBI_Fax_1")))
UBI_Fax_2=ReplaceTag(trim(request("UBI_Fax_2")))
UBI_Fax_3=ReplaceTag(trim(request("UBI_Fax_3")))
UBI_Fax_4=ReplaceTag(trim(request("UBI_Fax_4")))
UBI_Moble=ReplaceTag(trim(request("UBI_Moble")))
UBI_IM_No=ReplaceTag(trim(request("UBI_IM_No")))
UBI_IM_Type=ReplaceTag(trim(request("UBI_IM_Type")))
UBI_url=ReplaceTag(trim(request("UBI_url")))
if UBI_Tel_1<>"" and Isnumeric(UBI_Tel_1)=False then ERR_Number= True
if UBI_Tel_2<>"" and Isnumeric(UBI_Tel_2)=False then ERR_Number= True
if UBI_Tel_3<>"" and Isnumeric(UBI_Tel_3)=False then ERR_Number= True
if UBI_Tel_4<>"" and Isnumeric(UBI_Tel_4)=False then ERR_Number= True
if UBI_Fax_1<>"" and Isnumeric(UBI_Fax_1)=False then ERR_Number= True
if UBI_Fax_2<>"" and Isnumeric(UBI_Fax_2)=False then ERR_Number= True
if UBI_Fax_3<>"" and Isnumeric(UBI_Fax_3)=False then ERR_Number= True
if UBI_Fax_4<>"" and Isnumeric(UBI_Fax_4)=False then ERR_Number= True
if UBI_Moble<>"" and Isnumeric(UBI_Moble)=False then ERR_Number= True
if ERR_Number then
Response.Write "<script>alert('电话、传真、手机号必须为数字!');window.location=history.go(-1);</script>"
else
'检验帐户或昵称是否已经存在
OpenDB()
set rs=server.createobject("adodb.recordset")
sql="select * from RP_User_BasicInfo where UBI_mail='"&UBI_mail&"'"
rs.open sql,conn,1,1
if not rs.eof then'邮件地址判断
Response.Write("<script>alert('错误:邮件地址已经存在!!');history.go(-1);</script>")
rs.close
set rs=nothing
else
set rs=server.createobject("adodb.recordset")
sql="select * from RP_User_BasicInfo where UBI_name='"&UBI_name&"'"
rs.open sql,conn,1,1
if not rs.eof then '昵称判断
Response.Write("<script>alert('错误:您输入的昵称已经存在!!');history.go(-1);</script>")
rs.close
set rs=nothing
else
set rs=server.createobject("adodb.recordset")
sql="select * from RP_User_BasicInfo where UBI_CD='"&UBI_CD&"'"
rs.open sql,conn,1,1
if not rs.eof then '身份证号判断
Response.Write("<script>alert('错误:您确认输入的是您的身份证号吗?!!');history.go(-1);</script>")
rs.close
set rs=nothing
else
'将数据写进数据库
set rs=server.createobject("adodb.recordset")
sql="select * from RP_User_BasicInfo"
rs.open sql,conn,1,3
rs.addnew
'将必填信息写进数据库
rs("UBI_mail")=UBI_mail
rs("UBI_name")=UBI_name
rs("UBI_psw")=left(md5(md5("afdsa"&UBI_psw)&md5("afds"&UBI_psw&"fdsafdsaf")),16)
rs("UBI_QU")=UBI_QU
rs("UBI_AS")=left(md5(md5("xsdfsar234"&UBI_AS&"sdfgerwtfsar")&md5("xdfasdsKFJ234"&UBI_AS&"sdfERSSEFNBtr")),16)
rs("UBI_CD")=UBI_CD
'系统自动记录信息
rs("UBI_Reg_ip")=GetIP()
'选填信息记录
rs("UBI_sex")=UBI_sex
rs("UBI_GJ")=UBI_GJ
rs("UBI_sheng")=UBI_sheng
rs("UBI_City")=UBI_City
rs("UBI_Add")=UBI_Add
rs("UBI_Tel_1")=UBI_Tel_1
rs("UBI_Tel_2")=UBI_Tel_2
rs("UBI_Tel_3")=UBI_Tel_3
rs("UBI_Tel_4")=UBI_Tel_4
rs("UBI_Fax_1")=UBI_Fax_1
rs("UBI_Fax_2")=UBI_Fax_2
rs("UBI_Fax_3")=UBI_Fax_3
rs("UBI_Fax_4")=UBI_Fax_4
rs("UBI_Moble")=UBI_Moble
rs("UBI_IM_No")=UBI_IM_No
rs("UBI_IM_Type")=UBI_IM_Type
rs("UBI_url")=UBI_url
rs.update
rs.close
set rs=nothing
CloseDB()
Response.Write "<script>alert('恭喜您注册成功,请使用您的电子邮件和密码登录!');window.location='index.asp';</script>"
end if'身份证号判断
end if'昵称判断
end if'邮件地址判断
'验证判断结束
end if
'※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
end if
end if
else
Response.Write "<script>alert('禁止外部提交信息!');window.location='index.asp';</script>"
end if |
|