都是命令,我看不懂~
帮你顶上来吧~
你喜欢把这些叫做命令啊;P 原帖由 114535265 于 2006-5-17 14:53 发表
要学好ASP是不是把VB学好了~!~就解决了很大的一个问题呢????]
VBS、JS、JAVAS......
这是我写的处理注册信息的ASP文件,没判断是否重复登陆
<%@ Language="VBScript" %><% Response.Buffer=true %>
<%
dim conn,file
set conn=server.createobject("adodb.connection")
file=server.mappath("as1.mdb")
conn.open "driver={microsoft access driver (*.mdb)};DBQ=" & file
dim uid,pwd,affirm_pwd,name,sex,email
uid=trim(request.form("uid"))
pwd=trim(request.form("pwd"))
affirm_pwd=trim(request.form("affirm_pwd"))
name=trim(request.form("name"))
sex=trim(request.form("sex"))
email=trim(request.form("email"))
if uid="" or pwd="" or affirm_pwd="" then
response.write("请填写完整<a href=login.asp>返回</a>")
elseif pwd<>affirm_pwd then
response.write("两次密码不相同,请<a href=login.asp>返回</a>重填!")
response.end
else
sql1="select * from user where uid='"&uid&"' and pwd='"&pwd&"'"
set rs=conn.execute(sql1)
if rs.eof then
sql2="insert into user(uid,pwd,name,sex,email) values('"&uid&"','"&pwd&"','"&name&"','"&sex&"','"&email&"')"
conn.execute(sql2)
response.write("注册成功,感谢您对我们的支持!")
response.write("<meta http-equiv='refresh' content='5,url=login.asp'>")
response.write("如果没有自动跳转请点击<a href=login.asp>这里</a>")
else
response.write("该用户名已存在,请<a href=register.asp>返回</a>!")
end if
rs.close
set rs=nothing
end if
conn.close
set conn=nothing
%>
这是我的一个在某网络公司工作的朋友的,我觉得考虑得差不多了
<!--#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 好贴,经典~~
确实很基础
不过说一个小时搞定ASP,未免太牛了吧。。。小弟啃了四个月的ASP,至今未达到外面认可的ASP的中级水准 :( 基础只看的懂一半后面的就不用说了……似乎是VB的格式,但是有好多变量名都没见过的…… C++的基础上可以吗???????? 朋友们要你请客,在世纪大饭店大吃一顿后花去了 366 思明论坛!
下次努力哦!……都差不多的,学好C或者C++学其他相对简单了很多 市政中心政府上门慰问,发给你 333 思明论坛的慰问金!
下次努力哦!……现在期考老师叫我们交个ASP作品
还真烦。。。。:( :L :handshake :victory: :) :lol :( 啊哦噢哦~~~~~~~~1小时`啊`:Q 你中了彩票二等奖,获得奖金 852 思明论坛!
下次努力哦!……好好参合着好好学习吧 :victory: Wo也来顶.不错.
呵呵
你在街头拐角捡到一条珍珠项链,交还了失主,失主送给你 455 思明论坛的酬金!热心值加 1 !下次努力哦!……可选的很多,耐看的太少