📄 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 + -