4.3.2 网络考试管理模块的实现 本模块是采用的框架结构组成。左边是由Mainleft.asp组成,右边是由Mainright组成。根据左边的选项,右边出现相应的内容。其中左边有考生在线考试、考生成绩查询、退出考试系统模块。 copyright paper51.com 4.3.2.1考生在线考试 内容来自www.paper51.com
阅读完考试规则,就可以按规则进行考试,试卷上有考试总时间,考生已经用掉的时间和还剩余的时间。答完后点击“交卷“就可以看到自己的答题情况(还可以看到正确的答案),同时就可以看到自己的考试成绩。考试时间的控制是由以下代码实现: http://www.paper51.com dimstart_time,sec,min,hou 内容来自论文无忧网 www.paper51.com start_time =session("start_time") 内容来自论文无忧网 www.paper51.com sec = second(start_time) 内容来自www.paper51.com min = minute(start_time) copyright paper51.com hou = hour(start_time) copyright paper51.com sum = hou*3600 + min*60 + sec 内容来自论文无忧网 www.paper51.com
内容来自www.paper51.com
dim real_time,sec2,min2,hou2 内容来自www.paper51.com real_time = now() 内容来自论文无忧网 www.paper51.com sec2 = second(real_time) copyright paper51.com min2 = minute(real_time) 内容来自www.paper51.com hou2 = hour(real_time) http://www.paper51.com
http://www.paper51.com sum2 = hou2*3600 + min2*60 + sec2 paper51.com sum_cha = sum2 - sum http://www.paper51.com
aaa =sum_cha\3600 http://www.paper51.com bbb = (sum_cha mod 3600)\60 内容来自www.paper51.com ccc = (sum_cha mod 3600) mod60 copyright paper51.com if(ccc < 10)then 内容来自论文无忧网 www.paper51.com ccc = "0"&ccc 内容来自论文无忧网 www.paper51.com end if paper51.com
if(bbb < 10)then 内容来自论文无忧网 www.paper51.com
bbb = "0"&bbb paper51.com end if 内容来自论文无忧网 www.paper51.com
if(aaa < 10)then http://www.paper51.com aaa = "0"&aaa 内容来自www.paper51.com 答题完了后,显示的情况由以下主要代码组成(以单选为例): http://www.paper51.com sql_2 = "select * from Tab_questionswhere que_lessonid = "&getlesid&" and que_type = '单选题'" 内容来自论文无忧网 www.paper51.com set rs_2 =server.createobject("adodb.recordset") http://www.paper51.com rs_2.open sql_2,conn,1,3 paper51.com rs_2_num = 0 copyright paper51.com For i=1 to rs_2.recordcount http://www.paper51.com
rs_2_num = rs_2_num + 1 http://www.paper51.com if(request("single_answer["&i&"]") ="")then 内容来自www.paper51.com
response.write("无") paper51.com else paper51.com
response.write(request("single_answer["&i&"]")) 内容来自论文无忧网 www.paper51.com end if paper51.com
rs_2.movenext paper51.com 总成绩是由多项选择和单项选择组成的,所以要分别先算出单项选择的成绩,多项选择的成绩,最后才能够计算总成绩。成绩的统计主要代码如下: http://www.paper51.com if(session("lesid") = ""or session("UserID") = "")then paper51.com
response.Redirect("../Mainright.asp") paper51.com
response.End() copyright paper51.com end if copyright paper51.com response.write("<form name='hid_form'method='post' action='../Result.asp'>") copyright paper51.com dim res_single,res_more copyright paper51.com res_single = 0 http://www.paper51.com res_more = 0 内容来自论文无忧网 www.paper51.com getlesid = session("lesid") 内容来自www.paper51.com sql_1 = "select *from Tab_questions where que_lessonid = "&getlesid&" andque_type = '单选题'" 内容来自www.paper51.com set rs_1 =server.CreateObject("adodb.recordset") copyright paper51.com rs_1.open sql_1,conn,1,3 paper51.com for i=1 to rs_1.recordcount 内容来自www.paper51.com getsingle_answer =request("single_answer["&i&"]") http://www.paper51.com response.write("<inputtype='hidden' name='single_answer["&i&"]'value='"&getsingle_answer&"'>") paper51.com
if(instr(rs_1("que_answer"),getsingle_answer)> 0 and (len(getsingle_answer) =len(trim(rs_1("que_answer")))))then 内容来自www.paper51.com
res_single = res_single + 1 copyright paper51.com end if 内容来自www.paper51.com
rs_1.movenext 内容来自www.paper51.com next paper51.com rs_1.close http://www.paper51.com set rs_1 = nothing http://www.paper51.com
sql_2 = "select *from Tab_questions where que_lessonid = "&getlesid&" andque_type = '多选题'" http://www.paper51.com set rs_2 =server.CreateObject("adodb.recordset") paper51.com
rs_2.open sql_2,conn,1,3 内容来自论文无忧网 www.paper51.com for i=1 to rs_2.recordcount 内容来自论文无忧网 www.paper51.com getmore_answer =request("more_answer["&i&"]") copyright paper51.com
response.write("<inputtype='hidden' name='more_answer["&i&"]' value='"&getmore_answer&"'>") http://www.paper51.com if((instr(rs_2("que_answer"),getmore_answer)> 0 ) and (len(getmore_answer) =len(trim(rs_2("que_answer")))))then copyright paper51.com res_more = res_more + 1 http://www.paper51.com end if 内容来自论文无忧网 www.paper51.com rs_2.movenext copyright paper51.com next copyright paper51.com rs_2.close 内容来自www.paper51.com set rs_2 = nothing paper51.com response.write("</form>") paper51.com single_total = res_single * 2 内容来自www.paper51.com more_total = res_more * 5 内容来自www.paper51.com
if(session("UserID") <> "" andgetlesid <> "")then http://www.paper51.com sql_3 = "select Name from Tab_Lesson where ID ="&getlesid paper51.com
set rs_3 = conn.Execute(sql_3) paper51.com sql_4 = "insertinto Tab_stuResult(stu_id,which_lesson,res_single,res_more,res_subdate)values("&session("UserID")&",'"&rs_3("Name")&"',"&single_total&","&more_total&",'"&Now()&"')" paper51.com rs_3.close copyright paper51.com set rs_3 = nothing http://www.paper51.com conn.Execute(sql_4) copyright paper51.com end if paper51.com 4.3.2.2考生成绩查询 内容来自论文无忧网 www.paper51.com 选择此选项后,在右边就显示出查询条件和关键字。本设计中只有两个条件:一是考试课程,一是考试时间。选择其中任意一个后,在关键字里输入想查询的相应内容即可,实现的主要代码如下: 内容来自论文无忧网 www.paper51.com getcondition =replace(trim(request("condition")),"'","''") 内容来自www.paper51.com getkey =replace(trim(request("key")),"'","''") 内容来自www.paper51.com if(getcondition = "" or getkey ="")then http://www.paper51.com rssql = "select * from Tab_stuResult wherestu_id='"&session("UserID")&"'" http://www.paper51.com else http://www.paper51.com rssql = "select *from Tab_stuResult where "&getcondition&" like'%"&getkey&"%' andstu_id='"&session("UserID")&"' order by res_subdatedesc" 内容来自www.paper51.com end if copyright paper51.com set rs =server.createobject("adodb.recordset") http://www.paper51.com
rs.open rssql,conn,1,3 http://www.paper51.com rs.pagesize = 5 内容来自论文无忧网 www.paper51.com '实现分页 内容来自论文无忧网 www.paper51.com if rs.eof then paper51.com rs_total = 0 copyright paper51.com else http://www.paper51.com rs_total = rs.recordcount http://www.paper51.com end if paper51.com dim pageno copyright paper51.com getpageno =replace(trim(request("pageno")),"'","") http://www.paper51.com if(getpageno = "")then 内容来自www.paper51.com pageno = 1 内容来自www.paper51.com else http://www.paper51.com pageno = getpageno paper51.com End if paper51.com if(not rs.eof)then 内容来自www.paper51.com rs.absolutepage = pageno copyright paper51.com end if 内容来自www.paper51.com http://www.paper51.com |