📄 add_1.asp
字号:
<%response.buffer=true%>
<!--#INCLUDE FILE="../../system/odbc_connection.asp"--><html>
<head>
<title>申请第一步</title>
<link rel="stylesheet" href="../../system/all.css">
<script language="JAVASCRIPT">
<!--
function Trim(str){
while (str !="" && str.charAt(0) == " ") str = str.substring(1,str.length);
while (str !="" && str.charAt(str.length-1) == " ") str = str.substring(0,str.length-1);
return str;
}
function check_Null(){
if (Trim(document.form1.user_id.value)==""){
alert("用户名不能为空!");
return false;
}
if (Trim(document.form1.user_name.value)==""){
alert("真实姓名不能为空!");
return false;
}
if (Trim(document.form1.password.value)==""){
alert("密码不能为空!");
return false;
}
if (Trim(document.form1.password.value)!=Trim(document.form1.password2.value)){
alert("密码和密码确认必须一致!");
return false;
}
return true;
}
function touser2_OnChange(){
document.form1.to_user_1.value=document.form1.to_user_2.value;
}
function touser1_OnChange(){
document.form1.to_user_2.value="";
}
// -->
</script>
</head>
<body>
<h2 align=center>第一步:申请用户名</h2>
<p align="center" class="zhushi">注意:所有带**号的项目必须填写,除用户名外其它以后可以修改</p>
<center>
<form name="form1" method="POST" action="" onsubmit="javascript: return check_Null();">
<table border='0' width='80%' >
<tr>
<td width="30%">您的用户名</td>
<td width="70%"><input type="text" name="user_id" size="15">**(大于5位,小于20位,推荐用学号)</td>
</tr>
<tr>
<td>真实姓名</td>
<td ><input type="text" name="user_name" size="15">**</td>
</tr>
<tr>
<td >您的密码</td>
<td >
<input type="password" name="password" size="15">**
</td>
</tr>
<tr>
<td>确认密码</td>
<td ><input type="password" name="password2" size="15">**</td>
</tr>
</table>
<p align="center"><input type="submit" value=" 确 定 " name="submit">
</tr>
</form>
</center>
<%
'各项验证正确无误,则可继续注册,否则返回
if request("user_id")<>"" then
'先检验帐号正确否
Dim exit_flag,temp_str
exit_flag=0
If len(request("user_id"))<5 or len(request("user_id"))>20 Then
temp_str="<br>用户名必须大于5位小于20位"
exit_flag=1
End If
sql="select user_id from student where user_id='" & request("user_id") & "'"
set rs=db.execute(sql)
If not rs.eof and not rs.bof Then
exit_flag=1
temp_str="<br>已有学生使用该用户"
End If
sql="select user_id from teacher where user_id='" & request("user_id") & "'"
set rs=db.execute(sql)
If not rs.eof and not rs.bof Then
exit_flag=1
temp_str="<br>已有老师使用该用户"
End If
IF exit_flag=0 Then
'表示可以注册
Dim user_id,user_name,password
user_id=request("user_id")
user_name=request("user_name")
password=request("password")
sql="insert into student(user_id,password,user_name) values('" & user_id & "','" & password & "','" & user_name & "')"
db.execute(sql)
db.close
set db=nothing
session("user_id")=user_id
response.redirect "add_2.asp"
Else
response.write "<p align=center class=zhushi>提示:" & temp_str & ",请重新填写"
End If
end if
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -