📄 register2.asp
字号:
<%Response.Buffer=True%>
<!--#INCLUDE FILE="../odbc_connection2.asp"-->
<html>
<head>
<title>注册:第二步</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../style.css" rel="stylesheet" type="text/css">
<script language="javascript">
<!--
function check_Null(){
if (document.form1.UserId.value==""){
alert("用户名不能为空!");
return false;
}
if (document.form1.password.value==""){
alert("密码不能为空!");
return false;
}
if (document.form1.password.value!=document.form1.password2.value){
alert("密码和密码确认必须一致!");
return false;
}
return true;
}
// -->
</script>
</head>
<body >
<br>
<table width="607" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center" bgcolor="#FFFFFF">
<table width="90%" border="0">
<tr>
<td height="40" align="center"><h3><font color="#AB0000">用户注册</font></h3></td>
</tr>
<tr>
<td height="30">第二步 申请用户名(注意:所有带<font color=#990000> * </font>号的项目必须填写)
<hr size="1" noshade></td>
</tr>
</table>
<FORM name=form1 onsubmit="javascript: return check_Null();" action="" method="post">
<table width="80%" border=0 cellpadding="4" cellspacing="1" bgcolor="#999999">
<tr bgcolor="#FFFFFF">
<td width="21%" height="25">用户名</td>
<td width="79%"><input size=15 name="UserId" class="inputbox">
<font color=#990000>* </font>(大于或等于4位,小于20位)</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="25">密 码</td>
<td><input type=password size=15 name="password" class="inputbox">
<font color=#990000>* </font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="25">确认密码</td>
<td><input type=password size=15 name="password2" class="inputbox">
<font color=#990000>* </font></td>
</tr>
</table>
<br>
<input type=submit value=" 确 定 " name=submit class="inputbutton">
</FORM>
<br>
<%
'各项验证正确无误,则可继续注册,否则返回
if request("UserId")<>"" then
'先检验帐号正确否,如果正确,则exit_flag为0,否则为1
Dim exit_flag,strTemp
exit_flag=0
If len(request("UserId"))<4 or len(request("UserId"))>20 Then
strTemp="<br>用户名必须大于4位小于20位"
exit_flag=1
End If
Dim strSql,rs
strSql="Select UserId From Users Where UserId='" & request("UserId") & "'"
set rs=db.execute(strSql)
If not rs.eof and not rs.bof Then
exit_flag=1
strTemp="<br>已有人使用该用户"
End If
IF exit_flag=0 Then
'表示可以注册
Dim UserId,password
UserId=request("UserId")
password=request("password")
strSql="Insert Into users(UserId,password,UserType) Values('" & UserId & "','" & password & "','N')" 'N表示是普通用户
db.execute(strSql)
session("UserId")=UserId '用session记住用户名,以备register3.asp使用。
response.redirect "register3.asp"
Else
response.write "<p><font color='red'>提示:" & strTemp & ",请重新填写</font></p>"
End If
end if
%>
</td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -