网络考场(1)(转)logon.asp

80酷酷网    80kuku.com

  网络<% Language=VBScript %>
<%
if Request.ServerVariables("http_method")="POST" then
    if Request.Form("submit")="进入1" then
        '学生进入网络考场的处理
        set conn=server.CreateObject("adodb.connection")
        conn.ConnectionString="dsn=testsys"
        '连接并打开数据库
        conn.open
        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"
            set mrs=nothing
        else
        '如果数据库中不存在该学生的信息,显示的页面仍为logon.asp,并提示信息
            Response.Write "学生姓名与学号输入错误!!"
        end if
        conn.Close
        set conn=nothing
    else
        '教师进入网络考场的处理
        set conn=server.CreateObject("adodb.connection")
        conn.ConnectionString="dsn=testsys"
        conn.open
        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><FO

分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: