⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 result.asp

📁 自己的毕业设计 考试系统 ASP+ACCE
💻 ASP
字号:
<link href="../Style.css" rel="stylesheet" type="text/css">
<!--#include file="db.asp"-->
<%
subject=request("subject")
testid=request("testid")
singlecount=request("singlecount")
singleper=request("singleper")
multicount=request("multicount")
multiper=request("multiper")
judgecount=request("judgecount")
judgeper=request("judgeper")
userid=request.cookies("userid")
starttime=request("mystarttime")
endtime=time()
score=0
j=0
for each element in request.form
  for i=1 to request.form(element).count
    if instr(element,"NO")<>0 then
      id=mid(element,3,3)
      result=request.form(element)(i)
      sql="select * from question where id="& clng(id)
      set rs=server.createobject("adodb.recordset")
      rs.open sql,conn,3,2
      if rs("type")="单选题" then
        if result=rs("answer") then
          score=score+cint(singleper)
        end if
      end if
      if rs("type")="多选题" then
        if instr(rs("answer"),result)<>0 then
          score=score+cint(multiper)/4
          j=j+1
          answer=split(rs("answer"),",")
          answercount=ubound(answer)+1
          if answercount=j then
            score=score+cint(multiper)*(1-j/4)
          end if
        else
          score=score-cint(multiper)/4*(j)
        end if
      end if
      if rs("type")="判断题" then
        if rs("answer")=result then
          score=score+cint(judgeper)
        end if
      end if      
    end if
  next
next

sql="select * from score"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,2
rs.addnew
rs("userid")=userid
rs("username")=request.cookies("username")
rs("subject")=subject
rs("testid")=testid
rs("starttime")=starttime
rs("endtime")=endtime
rs("score")=score
rs.update
rs.close
sql="select * from test_record where testid="& testid & " and userid=" & userid
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,2
rs("tested")=1
rs.update
rs.close
response.redirect "displayresult.asp?userid=" & userid & "&testid=" & testid
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -