%
Server.ScriptTimeOut = 300
DB_CONNECTION_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("../../database/smwq_oc_test3.mdb") & ";"
QUIZ_TAG = "BZTEZ"
SAVE_ANSWERS = True
QUESTIONS_TO_SHOW = -1
RANDOM_QUESTIONS = True
RANDOM_ANSWERS = True
PASSWORD = ""
ALLOW_ONE_ACCESS = False
MAX_TIME = -1500
NO_BACK_BUTTON = False
NO_USER_CHANGES = False
SEND_ANSWERS_EMAIL_FROM = "yimin@yiminmathcentre.com"
SEND_ANSWERS_EMAIL = "yimin@yiminmathcentre.com"
SHOW_RIGHT_ANSWERS = True
SHOW_FULL_RESULTS = True
SHOW_TOTAL_SCORE = True
SHOW_EVALUATION = True
SHOW_COMMENT_AFTER_ANSWER = False
MULTI_PAGE = True
TIME_ZONE = 0
'SECURITY_OPTIONS = " ondragstart=""return false"" onselectstart=""return false"" onBeforePrint=""document.body.style.display = 'none';"" onAfterPrint=""document.body.style.display = 'block';"""
SHOW_PRINT_BUTTON = True
SHOW_CLOSE_BUTTON = False
SHOW_IP_ADDRESS = True
SHOW_PRINT_CERTIFICATE_BUTTON = True
SEND_ANSWERS_EMAIL_FORMAT = 0 '0=Questions and all given answers 1=Questions and wrong given answers 2=Questions and all given answers and all correct answers
SET_PAGECODE = False
USE_DEDICATED_PDF_COMPONENT = False
FORCE_UTF_8 = True
USE_TOPICS_STRUCTURE = False
If FORCE_UTF_8 Then
Response.CharSet = "utf-8"
Session.CodePage = 65001
Else
Response.CharSet = sLanguageString(53)
Session.CodePage = sLanguageString(54)
End If
Dim sCertificateSource, iQuizMaxScore, rsTopics, sQuestionsTopicID, iQuestionTopicsCount
CreditString = "
" & sLanguageString(0) & " "
'--- Do not edit below this line ---
iDBType = 0
If Instr(DB_CONNECTION_STRING, "Provider=SQLOLEDB.1") > 0 Then iDBType = 1
iTimeOut = Abs(MAX_TIME \ 60) * 2
If iTimeOut < 90 Then iTimeOut = 90
Session.TimeOut = iTimeOut
lUserID = CLng(Request.Form("UserID"))
iStatusID = CLng(Request.Form("StatusID")) '-1=Ready to evaluate, 0=First time, >0=Question number
iDirection = CLng(Request.Form("Direction")) '1=Next, -1=Back
sAnswersSequence = Request.Form("AnswersSequence")
If iStatusID > 1 And iDirection = 1 And MULTI_PAGE And SHOW_COMMENT_AFTER_ANSWER And Request.Form("Comments") <> "" Then
iStatusID = iStatusID - 1
bShowCommentsNow = True
End If
Function SLWQ_GetQuizMaxScore(cnnQuiz)
Dim RS, iScore, iQuestionScore, iScoRight, iScoWrong
Dim sRightAns, iScoNull, iAnsSco, i, iPos, bWrongFound
Dim iMaxAns, sChar, iMinScore, iMaxScore, aScores(), k
Dim aOutputScores(), j, bDoNotCheck
iScore = 0
k = 0
Set RS = cnnQuiz.Execute("SELECT * FROM Questions")
Do While Not RS.EOF
iQuestionScore = 0
iMaxAns = RS("MaxAnswers")
iScoRight = RS("ScoreRight")
iScoWrong = RS("ScoreWrong")
iScoNull = RS("ScoreNull")
sRightAns = RS("RightAnswer")
If RS("Type") = 0 Then 'Multiple Choise
iPos = InStr(sRightAns, "1")
For i = 1 To iMaxAns
If Not IsNull(RS("ScoreAnswer" & i)) Then
If i <> iPos Then
iScoWrong = iScoWrong + RS("ScoreAnswer" & i)
Else
iScoRight = iScoRight + RS("ScoreAnswer" & i)
End If
End If
Next
ElseIf RS("Type") = 1 Or RS("Type") = 2 Then 'Multiple Answer | True/False
bWrongFound = False
For i = 1 To iMaxAns
sChar = Mid(sRightAns, i, 1)
If Not IsNull(RS("ScoreAnswer" & i)) Then
If sChar = "1" Then iScoRight = iScoRight + RS("ScoreAnswer" & i)
iScoWrong = iScoWrong + RS("ScoreAnswer" & i)
If sChar <> "1" Then bWrongFound = True
End If
Next
If Not bWrongFound Then
iMinScore = 0
For i = 1 To iMaxAns
If Not IsNull(RS("ScoreAnswer" & i)) Then
If i = 1 Then iMinScore = RS("ScoreAnswer" & i)
If iMinScore > RS("ScoreAnswer" & i) Then iMinScore = RS("ScoreAnswer" & i)
End If
Next
iScoWrong = iScoWrong - iMinScore
End If
ElseIf RS("Type") = 3 Then 'FillIn
' Do nothing
End If
ReDim Preserve aScores(k)
If iScoWrong > iScoRight And iScoWrong > iScoNull Then
aScores(k) = iScore + iScoWrong
ElseIf iScoRight > iScoWrong And iScoRight > iScoNull Then
aScores(k) = iScore + iScoRight
ElseIf iScoNull > iScoWrong And iScoNull > iScoRight Then
aScores(k) = iScore + iScoNull
End If
If QUESTIONS_TO_SHOW < 0 Then
ReDim Preserve aOutputScores(k)
aOutputScores(k) = aScores(k)
End If
k = k + 1
RS.MoveNext
Loop
Set RS = Nothing
If QUESTIONS_TO_SHOW > 0 Then
If Not RANDOM_QUESTIONS Then
For i = 0 To (QUESTIONS_TO_SHOW-1)
ReDim Preserve aOutputScores(i)
aOutputScores(i) = aScores(i)
Next
Else
bDoNotCheck = False
ReDim aOutputScores(QUESTIONS_TO_SHOW-1)
For j = 0 To UBound(aOutputScores)
If j > UBound(aScores) Then
ReDim Preserve aOutputScores(j-1)
bDoNotCheck = True
Exit For
Else
aOutputScores(j) = aScores(j)
End If
Next
If Not bDoNotCheck Then
For i = j To UBound(aScores)
For k = 0 To UBound(aOutputScores)
If aOutputScores(k) < aScores(i) Then
aOutputScores(k) = aScores(i)
Exit For
End If
Next
Next
End If
End If
End If
For i = 0 To UBound(aOutputScores)
iScore = iScore + aOutputScores(i)
Next
SLWQ_GetQuizMaxScore = iScore
End Function
Function IsPrivateQuiz()
OpenConnection True
sSQL = "SELECT COUNT(*) FROM AllowedUsers"
If iDBType = 1 Then sSQL = sSQL & " AND QuizID=" & iQuizID
rsQuiz.Open sSQL, cnnQuiz, 1
IsPrivateQuiz = rsQuiz(0) > 0
CloseConnection rsQuiz, cnnQuiz
End Function
Function GetQuestionCount()
OpenConnection True
sSQL = "SELECT COUNT(*) FROM Questions"
If iDBType = 1 Then sSQL = sSQL & " AND QuizID=" & iQuizID
rsQuiz.Open sSQL, cnnQuiz, 1
GetQuestionCount = rsQuiz(0)
CloseConnection rsQuiz, cnnQuiz
End Function
Function CheckPassword()
If PASSWORD <> "" And UCase(Request.Form("TestPassword")) = UCase(PASSWORD) Then Session("TestPassword") = UCase(PASSWORD)
If PASSWORD <> "" And Session("TestPassword") <> UCase(PASSWORD) Then
PrintHeader ""
Response.Write "