#!/usr/bin/perl -w #ported from cgi-lib.pl to cgi.pm feb. 2002 jb use CGI qw(:cgi-lib); &ReadParse; #******************************VARIABLES******************** $answer1 = $in{'rdQ2'}; #User's answer $answertype = $in{'checkifcorrect'}; #Variable stores hidden input checks if answer right $user_tries = 0; #Variable used to store count of attempts at answering questions $user_finalscore = 0;#Variable used to store the final score of the user #**********************ANALYZE USER INPUT*************** #Check player's answer to question 1 if(($answer1 ne "") && ($answer1 ne undef) && ($answer1 eq "Lamar") || ($answer1 eq "Pope") || ($answer1 eq "Delaware") || ($answer1 eq "Hoover")) { &firstsetofresponses(); #Call subroutine that generates responses } #Check player's answer to question 2 elsif(($answer1 ne "") && ($answer1 ne undef) && ($answer1 eq "JA") || ($answer1 eq "FH") || ($answer1 eq "R") || ($answer1 eq "JM")) { &secondsetofresponses(); #Call subroutine that generates responses } #Check player's answer to question 3 elsif(($answer1 ne "") && ($answer1 ne undef) && ($answer1 eq "or") || ($answer1 eq "farm") || ($answer1 eq "gv") || ($answer1 eq "br")) { &thirdsetofresponses(); #Call subroutine that generates responses } #Check player's answer to question 4 elsif(($answer1 ne "") && ($answer1 ne undef) && ($answer1 eq "healthprob") || ($answer1 eq "andrewja") || ($answer1 eq "andrewjo") || ($answer1 eq "grovc")) { &fourthsetofresponses(); #Call subroutine that generates responses } #Check player's answer to question 5 elsif(($answer1 ne "") && ($answer1 ne undef) && ($answer1 eq "tedr") || ($answer1 eq "rreag") || ($answer1 eq "usg") || ($answer1 eq "grndfrm")) { &fifthsetofresponses(); #Call subroutine that generates responses } #Check player's answer to question 6 elsif(($answer1 ne "") && ($answer1 ne undef) && ($answer1 eq "ghs") || ($answer1 eq "gf") || ($answer1 eq "gb") || ($answer1 eq "zit")) { &sixthsetofresponses(); #Call subroutine that generates responses } #Check player's answer to question 7 elsif(($answer1 ne "") && ($answer1 ne undef) && ($answer1 eq "de") || ($answer1 eq "ug") || ($answer1 eq "capharry") || ($answer1 eq "zt")) { &seventhsetofresponses(); #Call subroutine that generates responses } #Check player's answer to question 8 elsif(($answer1 ne "") && ($answer1 ne undef) && ($answer1 eq "manyjobs") || ($answer1 eq "ww") || ($answer1 eq "howie") || ($answer1 eq "jc")) { &eighthsetofresponses(); #Call subroutine that generates responses } #Check player's answer to question 9 elsif(($answer1 ne "") && ($answer1 ne undef) && ($answer1 eq "rn") || ($answer1 eq "mb") || ($answer1 eq "grover") || ($answer1 eq "countyjudge")) { &ninthsetofresponses(); #Call subroutine that generates responses } #Check player's answer to question 10 elsif(($answer1 ne "") && ($answer1 ne undef) && ($answer1 eq "grcl") || ($answer1 eq "wilmc") || ($answer1 eq "sweet") || ($answer1 eq "frankrose")) { &tenthsetofresponses(); #Call subroutine that generates responses } #******************Control sequence of questions based on user answers***** #If the first answer is correct, output second question elsif($answertype eq "correct1") { &questionTop(); &question2(); } #If the first answer is wrong, output the first question again elsif($answertype eq "wrong1") { &questionTop(); &question1(); } #If the second answer is correct, output the third question elsif($answertype eq "correct2") { &questionTop(); &question3(); } #If the second answer is incorrect, output the second question again elsif($answertype eq "wrong2") { &questionTop(); &question2(); } #If the third answer is correct, output the fourth question elsif($answertype eq "correct3") { &questionTop(); &question4(); } #If the third answer is incorrect, output the third question again elsif($answertype eq "wrong3") { &questionTop(); &question3(); } #If the fourth answer is correct, output the fifth question elsif($answertype eq "correct4") { &questionTop(); &question5(); } #If the fourth answer is incorrect, output the fourth question again elsif($answertype eq "wrong4") { &questionTop(); &question4(); } #If the fifth answer is correct, output the sixth question elsif($answertype eq "correct5") { &questionTop(); &question6(); } #If the fifth answer is incorrect, output the fifth question again elsif($answertype eq "wrong5") { &questionTop(); &question5(); } #If the sixth answer is correct, output the seventh question elsif($answertype eq "correct6") { &questionTop(); &question7(); } #If the sixth answer is incorrect, output the sixth question again elsif($answertype eq "wrong6") { &questionTop(); &question6(); } #If the seventh answer is correct, output the seventh question elsif($answertype eq "correct7") { &questionTop(); &question8(); } #If the seventh answer is incorrect, output the seventh question again elsif($answertype eq "wrong7") { &questionTop(); &question7(); } #If the eighth answer is correct, output the ninth question elsif($answertype eq "correct8") { &questionTop(); &question9(); } #If the eighth answer is incorrect, output the eighth question again elsif($answertype eq "wrong8") { &questionTop(); &question8(); } #If the ninth answer is correct, output the tenth question elsif($answertype eq "correct9") { &questionTop(); &question10(); } #If the ninth answer is incorrect, output the ninth question again elsif($answertype eq "wrong9") { &questionTop(); &question9(); } #If the tenth answer is incorrect, output the tenth question again elsif($answertype eq "wrong10") { &questionTop(); &question10(); } #Output initial question page else{ &questionTop(); &question1(); } #******************************SUBROUTINES***************************************** #***************QUESTIONS SUBROUTINES******************** #*****SUBROUTINE THAT OUTPUTS HEADER FOR QUESTIONS******* sub questionTop { print "Content-type: text/html\n\n"; print "
WHERE'S HARRY?
How to Play\n";
}
#****************SUBROUTINE THAT OUTPUTS SECOND QUESTION*********************
sub question2 {
print "Where are Harry's Parents?
|
|