Case: How to achieve online exam?

Source: Internet
Author: User
Tags generator min trim visual studio
Here are some of the main programs that meet your assumptions, and you can continue to refine and expand them in practical applications:

Login.asp
' Examinee Verification
<%@ language=vbscript%>
<%
Name=trim (Request ("name"))
Passwd=trim (Request ("passwd"))
If name<> "" and passwd<> "" Then
' Check if candidates enter username and password
Set conn = Server.CreateObject ("ADODB. Connection ")
Conn. Open "Driver={microsoft Access driver (*.mdb)};
Dbq= "& Server.mappat (" Exercise.mdb ")
Set rs= Server.CreateObject ("Adodb.recordset")
Sql= "SELECT * from user where user=
' &name& ' and passwd= ' "and passwd & '"
Set rs= Conn. Execute (SQL)
' Validate candidates ' legality
If not (rs.eof) then
If RS ("score") <>0 then
' Check whether the candidate has taken the exam, and if so, make a query on the results
Response.Write rs ("user") & "exam results are" &rs ("score")
Else
Session ("Pass") =1
Session ("User") =name
Response.Redirect "Test.asp"
End If
Else
Response.Write "Oh, the username or password you entered is incorrect!"
End If
Else
End If
%>
<HTML>
<HEAD>
<meta name= "generator" content= "Microsoft Visual Studio 6.0" >
<TITLE> Wonderful spring Wind candidates login </TITLE>
</HEAD>
<BODY>
<form action= "Login.asp" id=
FORM1 Method=post name=form1>
<p title= "" > </P>
<p title= "" > </P>
<p title= "" Align=center> candidates:
<input id=text1 name=name style= "HEIGHT:22PX; Width:103px "></P>
<p title= "" Align=center> Password:
<input id=password1 name=passwd style= "HEIGHT:23PX; width:101px "type=password></p>
<p title= "" align=center>
<input id=submit1 name=submit1 type=submit value= "Enter style=" Font-size:medium; Font-style:normal; Font-variant:normal; Font-weight:bold "title=" "></P>
<p title= "" align=center>
</P>
</FORM>
</BODY>
</HTML>

Test.asp
' Take the exam from the question bank
<%@ Language=vbscript%>
<%
If session ("pass") <>1 Then
Response.Redirect "Login.asp"
Else
End If
Set conn = Server.CreateObject ("ADODB. Connection ")
Conn. Open "Driver={microsoft Access driver (*.mdb)};
Dbq= "& Server.MapPath (" Exercise.mdb ")
Sql= "SELECT * FROM Test"
Set RS = conn. Execute (SQL)
' Extract the questions
%>

<script language= "JavaScript" >
var isn1=null;
var Isn2=false;
Today=new Date ();
function StoPit () {
if (ISN2) {
Cleartimeout (ISN1);
}
ISN2 = false;
}
function Startit () {
StoPit ();
Isnclock ();
}
function Isnclock () {
var now=new Date ();
var hrs=now.gethours ();
var min=now.getminutes ();
var sec=now.getseconds ();
Document.clckh.disp.value= "" + (HRS&GT;12) (hrs-12:hrs);
Document.clckm.disp.value= ((min<10)? "0": "") +min;
Document.clcks.disp.value= ((sec<10)? "0": "") +sec;
Document.clck.disp.value= (hrs>=12)? "p.m.": "A.M";
Isn1=settimeout ("Isnclock ()", 1000);
Isn2=true;
}
</SCRIPT>
' Above is a timer function

<HTML>
<HEAD>
<meta name= "generator" content= "Microsoft Visual Studio 6.0" >
</HEAD>
<body onload= "Startit ()" bgcolor= "FFFFFF" >
<center>
' Call the timer function to show the time
<table border=2>
<TR>
<TD>Time</TD><TD>Hour</TD><TD>Min</TD><TD>Sec</TD><TD> </TD>
</TR>
<TR>
<TD></TD>
&LT;TD valign=top><form name= "Clckh" onsubmit= "0" >
<input type= "text" name= "disp" size=2 VALUE = "" >
</FORM></TD>
&LT;TD valign=top><form name= "clckm" onsubmit= "0" >
<input type= "text" name= "disp" size=2 VALUE = "" >
</FORM></TD>
&LT;TD valign=top><form name= "clcks" onsubmit= "0" >
<input type= "text" name= "disp" size=2 VALUE = "" >
</FORM></TD>
&LT;TD valign=top><form name= "Clck" onsubmit= "0" >



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.