📄 student_register3.asp
字号:
<!-- Created: 2001-5-10 13:32:20 -->
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft FrontPage 4.0">
<TITLE>数学系同学录注册</TITLE>
<!--
body { font-family: "宋体"; font-size: 9pt}
table { font-family: "宋体"; font-size: 9pt}
-->
</style>
</HEAD>
<BODY bgcolor="#EFFDE3" bgcolor="#F3BC9E">
<p align="center"> </p>
<div align="center">
<center>
<table border="0" width="658" height="33" cellspacing="0">
<tr>
<td width="17" height="20" bgcolor="#FF9966"> </td>
<td width="612" height="20" bgcolor="#FF9966" colspan="3"> </td>
<td width="21" height="20" bgcolor="#FF9966"> </td>
</tr>
<tr>
<td width="17" height="221" bgcolor="#FF9966" rowspan="3"> </td>
<td width="612" height="44" valign="bottom" colspan="3"></center>
<p align="center"></td>
<center>
<td width="21" height="33" bgcolor="#FF9966" rowspan="4"> </td>
</tr>
<tr>
<td width="20" height="251" valign="top" rowspan="2"></td>
<td width="562" height="9" valign="top"></td>
<td width="23" height="251" valign="top" rowspan="2"></td>
</tr>
<tr>
<td width="562" height="238" valign="top">
<%
'检测表单的有效性
If IsEmpty(request.form("name")) or request.form("name")="" then
response.write "<center><b>您没有输入姓名."
response.write "<form>"
response.write "<input type='button' value='重试' onclick=history.back()>"
response.write "</form>"
response.end
End If
If IsEmpty(request.form("password")) or request.form("password")="" then
response.write "<center><b>您没有输入密码."
response.write "<form>"
response.write "<input type='button' value='重试' onclick=history.back()>"
response.write "</form>"
response.end
End If
If request.Form("password")<>request.form("password2") then
response.write "<center><b>两次密码输入不一致."
response.write "<form>"
response.write "<input type='button' value='重试' onclick=history.back()>"
response.write "</form>"
response.end
End If
If IsEmpty(request.form("email")) or request.form("email")="" then
response.write "<center><b>您没有输入电子邮箱."
response.write "<form>"
response.write "<input type='button' value='重试' onclick=history.back()>"
response.write "</form>"
response.end
End If
IF INSTR(Request.Form("email"),"@")=0 OR INSTR(Request.Form("email"),".")=0 THEN
response.write "<center><b>你必须正确输入你的电子邮箱,以便我们与你联系."
response.write "<form>"
response.write "<input type='button' value='重试' onclick=history.back()>"
response.write "</form>"
response.end
End If
If IsEmpty(request.form("xuehao")) or request.form("xuehao")="" then
response.write "<center><b>您没有输入学号."
response.write "<form>"
response.write "<input type='button' value='重试' onclick=history.back()>"
response.write "</form>"
response.end
End If
'定义变量
function change(s)
change = replace(replace(s, "'","''"),"""","""""")
end function
dim name,password,password2,adr,youbian,tel,sex,email,oicq,grade,class1,xuewei,class2,xuehao,note,RS
name=change(request.form("name"))
password=change(request.form("password"))
password2=change(request.form("password2"))
adr=change(request.form("adr"))
youbian=change(request.form("youbian"))
tel=change(request.form("tel"))
sex=change(request.form("sex"))
email=change(request.form("email"))
oicq=change(request.form("oicq"))
grade=change(request.form("grade"))
class1=change(request.form("class1"))
xuewei=change(request.form("xuewei"))
class2=change(request.form("class2"))
xuehao=change(request.form("xuehao"))
note=change(request.form("note"))
' 将记录添加到数据库中
set conn = server.createobject("adodb.connection")
conn.open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & server.mappath("./user.mdb")
SQLstmt = "INSERT INTO student(姓名,密码,确认密码,联系地址,邮编,电话,性别,email,OICQ,入学年度,专业,学位,班级,学号,备注)"
SQLstmt = SQLstmt & " VALUES ("
SQLstmt = SQLstmt & "'" & name & "',"
SQLstmt = SQLstmt & "'" & password & "',"
SQLstmt = SQLstmt & "'" & password2 & "',"
SQLstmt = SQLstmt & "'" & adr & "',"
SQLstmt = SQLstmt & "'" & youbian & "',"
SQLstmt = SQLstmt & "'" & tel & "',"
SQLstmt = SQLstmt & "'" & sex & "',"
SQLstmt = SQLstmt & "'" & email & "',"
SQLstmt = SQLstmt & "'" & oicq & "',"
SQLstmt = SQLstmt & "'" & grade & "',"
SQLstmt = SQLstmt & "'" & class1 & "',"
SQLstmt = SQLstmt & "'" & xuewei & "',"
SQLstmt = SQLstmt & "'" & class2 & "',"
SQLstmt = SQLstmt & "'" & xuehao & "',"
SQLstmt = SQLstmt & "'" & note & "'"
SQLstmt = SQLstmt & ")"
conn.execute(SQLstmt)
If err.number>0 then
response.write "VBScript Errors Occured:" & "<P>"
response.write "Error Number=" & err.number & "<P>"
response.write "Error Descr.=" & err.description & "<P>"
response.write "Help Context=" & err.helpcontext & "<P>"
response.write "Help Path=" & err.helppath & "<P>"
response.write "Native Error=" & err.nativeerror & "<P>"
response.write "Source=" & err.source & "<P>"
response.write "SQLState=" & err.sqlstate & "<P>"
end if
IF conn.errors.count> 0 then
response.write "Database Errors Occured" & "<P>"
response.write SQLstmt & "<P>"
for counter= 0 to conn.errors.count
'response.write "Error #" & conn.errors(counter).number & "<P>"
'response.write "Error desc. -> " & conn.errors(counter).description & "<P>"
next
else
response.write "你已经成功注册。<p>"
response.write date() & "<p>"
end if
Conn.Close
set Conn=nothing
response.write"<hr>"
response.write"<br>"
response.write"由此进入数学系站点——>"
%>
<input type=button value=欢迎进入 onClick="document.location='index2.htm'">
</center>
</td>
</tr>
<center>
<tr>
<td width="17" height="1" bgcolor="#FF9966"> </td>
<td width="612" height="1" bgcolor="#FF9966" colspan="3"> </td>
</tr>
</table>
</center>
</div>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -