📄 createresult.asp
字号:
<!--#include file="conn.inc"-->
<%
subject=request("subject")
testid=request("testid")
singlecount=CInt(request("singlecount"))
singleper=CInt(request("singleper"))
multicount=CInt(request("multicount"))
multiper=CInt(request("multiper"))
judgecount=CInt(request("judgecount"))
judgeper=CInt(request("judgeper"))
userid=request.cookies("userid")
starttime=request("mystarttime")
endtime=time()
score=0
for each element in request.form
j=0
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 exam_database 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
'response.write id & ":"& result&"<br />"
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)
score=score+cint(multiper)
end if
'else
'score=score-cint(multiper)/4*(j)
' score=score-cint(multiper)
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
'response.End
sql="select * from exam_score"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,2
rs.addnew
rs("userid")=userid
rs("username")=request.cookies("username")
rs("department")=request.cookies("department")
rs("office")=request.cookies("office")
rs("duties")=request.cookies("duties")
rs("subject")=subject
rs("testid")=testid
rs("starttime")=starttime
rs("endtime")=endtime
rs("score")=score
rs.update
rs.close
sql="select * from exam_testuser where testid="& testid & " and userid=" & userid
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,2
rs("havetest")=1
rs.update
rs.close
response.redirect "displayresult.asp?userid=" & userid & "&testid=" & testid
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -