<%if Session("name")="" then Response.Redirect("index.asp") else if Session("question_num")>=Session("TotalQuestions") then Response.Redirect("score.asp") end if end if Session("question_num")=Session("question_num")+1 GameDir="/asp-ohr" Dim aQuestion(20) aryQuestion=aQuestion Dim Answers(6) Answer=Answers Set FileObject = Server.CreateObject("Scripting.FileSystemObject") Set objTextStreamIn = FileObject.OpenTextFile(Server.MapPath(GameDir) & "/choice.qh", 1, False, False) 'finds number of lines in file TotalLines=0 While not objTextStreamIn.AtEndOfStream objTextStreamIn.SkipLine TotalLines=TotalLines+1 Wend 'Returns pointer to beginning of file. This is a really bad method of doing this, but I don't think VBScript has any Move methods for this object objTextStreamIn.Close Set objTextStreamIn = FileObject.OpenTextFile(Server.MapPath(GameDir) & "/choice.qh", 1, False, False) 'picks a random place in file and finds beginning of question Randomize LineNum=Int(Int(Rnd()*TotalLines*100)/100) For i=1 to LineNum-1 objTextStreamIn.SkipLine Next Do Until (objTextStreamIn.Read(1) = "+") objTextStreamIn.SkipLine LineNum=LineNum+1 if objTextStreamIn.AtEndOfStream then objTextStreamIn.Close Set objTextStreamIn = FileObject.OpenTextFile(Server.MapPath(GameDir) & "/choice.qh", 1, False, False) LineNum=int(Rnd()*TotalLines) For i=0 to LineNum objTextStreamIn.SkipLine Next end if Loop 'Check line number of question to see if it has already appeared in game. If not, record it so ' that it will not be used again in this game. if Instr(Session("used"), "," & LineNum & ",") then objTextStreamIn.Close Session("question_num") = Session("question_num")-1 Response.Redirect("main.asp") else Session("used")=Session("used") & LineNum & "," end if 'puts question into array, one line at a time i=0 Do While (1) aryQuestion(i)=objTextStreamIn.ReadLine if InStr(aryQuestion(i), "--------") then Exit Do end if i=i+1 Loop NewLines=i+1 'ReDim Preserve Question(NewLines) 'Question=Array(NewLines) Question=aryQuestion objTextStreamIn.Close Set FileObject=Nothing Set objTextStreamIn=Nothing 'breaks array into separate variables for question, answers, and explanation i=0 Do Until (Left(Question(i), 1)=":" or Left(Question(i), 1)="*") i=i+1 Loop question_text="" For j=0 to i-1 question_text=question_text & Chr(13) & Question(j) Next Session("question_text")=question_text k=i Do Until (Left(Question(k), 1)="#") if Left(Question(k), 1)= "" then Exit Do end if k=k+1 Loop m=0 For l=i to k-1 Answers(m)=Right(Question(l), Len(Question(l))-1) if Left(Question(l), 1)="*" then Session("RightAnswer")=m end if m=m+1 Next Question(k)=Right(Question(k), Len(Question(k))-1) Session("answers")=Answers explanation="" For n=k to NewLines-2 explanation=explanation & Chr(13) & Question(n) Next Session("explanation")=explanation i=int(int(Rnd()*Session("No_Ques_Marks")*100)/100) QMF=Session("aryQMF")(i) QMW=Session("aryQMW")(i) QMH=Session("aryQMH")(i)%> Jewish IQ - Question <%=Session("question_num")%> of <%=Session("TotalQuestions")%>

Jewish IQ Question <%=Session("question_num")%> of <%=Session("TotalQuestions")%>
<%=question_text%>


Ohr Somayach Institutions is an international network of Yeshivot and outreach centers, with branches in North America, Europe, South Africa and South America. The Central Campus in Jerusalem provides a full range of educational services for over 685 full-time students.

The Jewish Learning Exchange (JLE) of Ohr Somayach offers summer and winter programs in Israel that attract hundreds of university students from around the world for 3 to 8 weeks of study and touring.

The Ohr Somayach Home Page is hosted by Virtual Jerusalem
vj_bar.gif (1798 bytes)

Copyright © 1998 Ohr Somayach International.