?? logon.asp
字號:
<%@ Language=VBScript %>
<%
startime=timer()
dim conn
dim connstr
dim db
dim rs
dim sqlstr
'更改數據庫名字
db="testsys.MDB"
if Request.ServerVariables("http_method")="POST" then
if Request.Form("submit")="進入1" then
'學生進入網絡考場的處理
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&"")
'如果你的服務器采用較老版本Access驅動,請用下面連接方法
' connstr="driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath(""&db&"")
conn.Open connstr
strsql="select * from studentinfo where stid='" & Request.Form("stid") & "' and stname='" & Request.Form("stname") & "'"
set mrs=conn.Execute(strsql)
if not mrs.bof and not mrs.eof then
'如果數據庫中存在該學生的記錄進入網絡考場
'并用session屬性存儲學生的姓名與學號
session("stid")=Request.Form("stid")
session("stname")=Request.Form("stname")
response.redirect "stselectsub.asp"
'Response.Redirect "stselectsub.asp"
'response.end
set mrs=nothing
else
'如果數據庫中不存在該學生的信息,顯示的頁面仍為logon.asp,并提示信息
Response.Write "學生姓名與學號輸入錯誤!!"
end if
conn.Close
set conn=nothing
else
'教師進入網絡考場的處理
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&"")
'如果你的服務器采用較老版本Access驅動,請用下面連接方法
' connstr="driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath(""&db&"")
conn.Open connstr
strsql="select * from teacherinfo where teachid='" & Request.Form("teachid") & "' and teachname='" & Request.Form("teachname") & "'"
set mrs=conn.Execute(strsql)
if not mrs.bof and not mrs.eof then
'如果數據庫中存在該教師的記錄進入網絡考場
'用session屬性保持教師姓名與編號
session("teachid")=Request.Form("teachid")
session("teachname")=Request.Form("teachname")
Response.Redirect "tcreatefrm2.asp"
else
'如果數據庫中不存在該教師的信息,顯示的頁面仍為logon.asp,并提示信息
Response.Write "教師的姓名和編號輸入錯誤!!"
end if
set mrs=nothing
'關閉數據庫連接
conn.close
'清空對象變量
set conn=nothing
end if
end if
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<FORM action="logon.asp" method=post id=form1 name=form1>
<P align=center>
<FONT color=crimson face=隸書 size=6>網 絡 考 場</FONT></P>
<P align=center>
<TABLE border=0 cellPadding=1 cellSpacing=1 width=75%>
<TR bgcolor=wheat>
<TD>
<DIV align=center><STRONG><FONT
color=mediumslateblue face=幼圓 size=4>學 生</FONT></STRONG></DIV>
<TD>
<DIV align=center><FONT color=mediumslateblue
face=幼圓 size=4><STRONG>教
師</STRONG></FONT></DIV>
<TR bgcolor=ivory>
<TD>
<P align=center>姓名<INPUT id=text1 name=stname></P></TD>
<TD>
<P align=center>姓名<INPUT id=text2 name=teachname value=zhong></P></TD></TR>
<TR bgcolor=ivory>
<TD>
<P align=center>學號<INPUT id=password1 name=stid type=password></P></TD>
<TD>
<P align=center>編號<INPUT id=password1 name=teachid type=password ></P></TD></TR>
<TR bgcolor=ghostwhite>
<TD >
<DIV align=center><INPUT id=submit1 name=submit type=submit value=進入1 ></DIV></TD>
<TD>
<DIV align=center><INPUT id=submit2 name=submit type=submit value=進入2></DIV></TD></TR></TABLE></P>
</FORM>
</BODY>
</HTML>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -