📄 reg.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="ChkErr.asp"-->
<!--#include file="ResultMsg.asp"-->
<!--#include file="md5.asp"-->
<!--#include file="ChkEmail.asp"-->
<%
If Request("IsReg")<>"" Then
'判断用户输入的合法性
If Request("UserName")="" Or Request("UserPassword")="" Or Request("ConfirmPassword")="" Or Request("Email")="" Then
ResultMsg("必填的项目没有填写,请返回重新填写完整的信息!")
Response.End
End If
Dim tmpUserName
For i=1 To Len(Request("UserName"))
tmpUserName=tmpUserName&" "
Next
If tmpUserName=Request("UserName") Then
ResultMsg("请不要输入空格代替必填项目,请返回重新填写完整的信息!")
Response.End
End If
If Request("UserPassword")<>Request("ConfirmPassword") Then
ResultMsg("两次输入的密码不匹配,请返回重新输入!")
Response.End
End If
If IsValidEmail(Request("Email"))=False Then
ResultMsg("Email输入不符合规范,请返回重新输入!")
Response.End
End If
If Request("QQ")<>"" Then
If IsNumeric(Request("QQ"))=False Then
ResultMsg("QQ号码必须为数字,请返回重新输入!")
Response.End
End If
End If
If InStr(Request("UserName"),"'")>0 Or InStr(Request("UserPassword"),"'")>0 Then
ResultMsg("字符“'”为非法输入,请去掉此字符!")
Response.End
End If
If Len(Request("UserName"))>20 Or Len(Request("UserPassword"))>20 Or Len(Request("Email"))>50 Or Len(Request("QQ"))>20 Then
ResultMsg("输入超出了最大字符数量限制(用户名20字符以内,密码20字符以内,Email 50字符以内,QQ 20字符以内。)")
Response.End
End If
'取得用户输入
Dim UserName,UserPassword,Email,QQ
UserName=Server.HTMLEncode(Request("UserName"))
UserPassword=md5(Request("UserPassword"))
Email=Server.HTMLEncode(Request("Email"))
QQ=Request("QQ")
'判断用户是否已存在
strSQL="SELECT UI_Name_S FROM [UserInfo] WHERE UI_Name_S='"&Request("UserName")&"'"
Set objRS=Server.CreateObject("ADODB.RecordSet")
objRS.Open strSQL,objConn,1,3
If Not objRS.BOF Or Not objRS.BOF Then
ResultMsg("所注册的用户名已存在,请更换用户重新注册!")
Response.End
End If
objRS.Close
'将用户信息写入数据库
strSQL="INSERT INTO [UserInfo] (UI_PI_ID_FN,UI_Name_S,UI_Password_S,UI_IsLocked_B,UI_CerRank_N,UI_IsProvider_B,UI_Email_S,UI_QQ_S,UI_IsAdmin_B,UI_RentCount_N)"&_
"VALUES(0,'"&UserName&"','"&UserPassword&"',False,0,False,'"&Email&"','"&QQ&"',False,0)"
objConn.Execute(strSQL)
ResultMsg("您的注册已成功!")
Set objRS=Nothing
CloseDatabase
Else
%>
<html>
<head>
<meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>用户注册</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<form action=reg.asp>
<table class=tableborder1 align=center cellspacing=1 cellpadding=3 width=90% height=30%>
<tr><th colspan=2 id=tabletitlelink height=25 style=font-weight:normal align=center>用户注册(*项目必填)</th></tr>
<tr><td class=TableBody2 align=right width=20% >*用户名:</td><td class=tablebody1 style='color:#666666'><input type=text name=UserName maxlength=20 size=50></td></tr>
<tr><td class=TableBody2 align=right width=20% >*密码:</td><td class=tablebody1 style='color:#666666'><input type=password name=UserPassword maxlength=20 size=50></td></tr>
<tr><td class=TableBody2 align=right width=20% >*确认密码:</td><td class=tablebody1 style='color:#666666'><input type=password name=ConfirmPassword maxlength=20 size=50></td></tr>
<tr><td class=TableBody2 align=right width=20% >*Email:</td><td class=tablebody1 style='color:#666666'><input type=text name=Email maxlength=50 size=50></td></tr>
<tr><td class=TableBody2 align=right width=20% >QQ:</td><td class=tablebody1 style='color:#666666'><input type=text name=QQ maxlength=20 size=50></td></tr>
<tr><td class=TableBody2 align=center width=20% colspan=2><input type=submit value=注册> <input type=reset value=重写> <input type=button value=关闭 onclick=vbscript:window.close()></td></tr>
</table>
<input type=hidden name=IsReg value=ok>
</form>
</body>
</html>
<%End If%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -