?? createresult.asp
字號:
<!--#include file="conn.inc"-->
<%
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 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
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 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 + -