?? reg2.asp
字號:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="xuanke.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
@import url("style.css");
-->
</style>
</head>
<%
dim err(4)
dim s_no,name,psw,psw2,sex,major,classes
dim rs_test_name,rs_user
'接收數據----------------------------
s_no=request("s_no")
name=request("name")
psw=request("psw")
psw2=request("psw2")
sex=request("sex")
%>
<body>
<%
'檢驗數據-----------------------------
'檢查學號是否存在--------------------
set rs_test_name=server.CreateObject("adodb.recordset")
sql = "select * from student where name='" & request("name") & "'"
sql = sql & "or s_no = '" & request("s_no") & "'"
rs_test_name.open sql,xuanke_conn,3,2
if not(rs_test_name.eof or rs_test_name.bof) then err(1)="這個用戶名或學號已經注冊!"
if len(name)>20 then err(2)="用戶名不能超過20個字符"
if len(name)<1 then err(2)="用戶名不能少于1個字符"
if psw <> psw2 then err(3)="兩次輸入的密碼不一致"
if len(psw)>16 then err(4)="密碼不能超過16位"
if len(psw)<4 then err(4)="密碼不能少于4位"
for i=1 to 4
if err(i)<>""then haveerr="yes"
next
%>
<div align="center">
<table width="760" border="0" class="table_big">
<tr>
<td valign="top"><div align="center">
<!--#include file="include/head.asp" -->
<% If haveerr="yes" Then %>
<br>
<table width="450" border="0" class="table_small">
<tr>
<td> </td>
</tr>
<tr>
<td class="text_title"><div align="left">在您提交的個人檔案必欄目中發現如下問題:</div></td>
</tr>
<tr>
<td class="table_title"> </td>
</tr>
<tr>
<td class="text_error">
<div align="left">
<%
for i=1 to 4
If err(i)<> "" Then
response.Write("●" & err(i) & "<br>")
end if
next
%>
</div></td>
</tr>
<tr>
<td class="text"><div align="center">[<a href="reg.asp">返回</a>]</div></td>
</tr>
</table>
<% Else %>
<br>
<%
'寫入數據庫----------------
set rs_user=server.CreateObject("adodb.recordset")
rs_user.open "select * from student",xuanke_conn,3,2
rs_user_total=(rs_user.RecordCount)+1
If (rs_user.RecordCount = -1) Then
rs_user_total=0
While (Not rs_user.EOF)
rs_user_total = rs_user_total + 1
rs_user.MoveNext
Wend
end if
'添加記錄-----------------
rs_user.addnew
rs_user("name")=name
rs_user("s_no")=s_no
rs_user("psw")=psw
rs_user("sex")=sex
rs_user.update
session("s_no") = s_no
%>
<table width="450" border="0" class="table_small">
<tr>
<td class="text_title"> </td>
</tr>
<tr>
<td class="text_title"><div align="left">注冊成功,恭喜您成為第<%= rs_user_total %>位用戶!</div></td>
</tr>
<tr>
<td class="table_title"> </td>
</tr>
<tr>
<td class="text"><p align="left">●您現在已經成為本系統的正式用戶<br>
●課程預約和查詢功能已經開放<br>
●您可以隨時修改新的資料</p> </td>
</tr>
<tr>
<td class="text"><div align="center">[<a href="index.asp">回到首頁</a>]</div></td>
</tr>
</table>
<% End If %>
<br>
<!--#include file="include/foot.asp" -->
<br>
</div></td>
</tr>
</table>
</div>
</body>
</html>
<title><%If haveerr="yes" Then response.Write("發現問題!") Else response.Write("注冊成功!") End If%></title>
<% set rs_user= nothing %>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -