#!/usr/local/bin/perl $password = "test"; $quizmastercgilocation = "http://www.mydomain.com/cgi-bin/quizmaster.cgi"; $quizcgilocation = "http://www.mydomain.com/cgi-bin/quiz.cgi"; $quizhtmldirectory = "/usr/home/mydomainname/public_html/quiz"; $quizhtmldirectoryurl = "http://www.mydomain.com/quiz"; read(STDIN, $input, $ENV{'CONTENT_LENGTH'}); # split the input @pairs = split(/&/, $input); # split the name/value pairs foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $name =~ tr/+/ /; $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s/<([^>]|\n)*>//g; $FORM{$name} = $value; } #translate form input into scalar variables $pass = $FORM{'pass'}; $title = $FORM{'title'}; $nowwhat = $FORM{'nowwhat'}; $lessthanhalf = $FORM{'lessthanhalf'}; $morethanhalf = $FORM{'morethanhalf'}; $reallygood = $FORM{'reallygood'}; $emailyesorno = $FORM{'emailyesorno'}; $email = $FORM{'email'}; $returnlinkurl = $FORM{'returnlinkurl'}; $returnlinktext = $FORM{'returnlinktext'}; $again = $FORM{'again'}; $colororimage = $FORM{'colororimage'}; #0 for BGimage 1 for BGcolor $bgcolor = $FORM{'bgcolor'}; $bgimageurl = $FORM{'bgimageurl'}; $textcolor = $FORM{'textcolor'}; $linkcolor = $FORM{'linkcolor'}; $vlinkcolor = $FORM{'vlinkcolor'}; $alinkcolor = $FORM{'alinkcolor'}; $numques = $FORM{'numques'}; $leadingtext = $FORM{'leadingtext'}; $trailingtext = $FORM{'trailingtext'}; $onemoretime = $FORM{'onemoretime'}; $filename = $FORM{'filename'}; $ques1 = $FORM{'ques1'}; $q1ans = $FORM{'q1ans'}; $q1opt1 = $FORM{'q1opt1'}; $q1opt2 = $FORM{'q1opt2'}; $q1opt3 = $FORM{'q1opt3'}; $q1opt4 = $FORM{'q1opt4'}; $q1opt5 = $FORM{'q1opt5'}; $q1opt6 = $FORM{'q1opt6'}; $ques2 = $FORM{'ques2'}; $q2ans = $FORM{'q2ans'}; $q2opt1 = $FORM{'q2opt1'}; $q2opt2 = $FORM{'q2opt2'}; $q2opt3 = $FORM{'q2opt3'}; $q2opt4 = $FORM{'q2opt4'}; $q2opt5 = $FORM{'q2opt5'}; $q2opt6 = $FORM{'q2opt6'}; $ques3 = $FORM{'ques3'}; $q3ans = $FORM{'q3ans'}; $q3opt1 = $FORM{'q3opt1'}; $q3opt2 = $FORM{'q3opt2'}; $q3opt3 = $FORM{'q3opt3'}; $q3opt4 = $FORM{'q3opt4'}; $q3opt5 = $FORM{'q3opt5'}; $q3opt6 = $FORM{'q3opt6'}; $ques4 = $FORM{'ques4'}; $q4ans = $FORM{'q4ans'}; $q4opt1 = $FORM{'q4opt1'}; $q4opt2 = $FORM{'q4opt2'}; $q4opt3 = $FORM{'q4opt3'}; $q4opt4 = $FORM{'q4opt4'}; $q4opt5 = $FORM{'q4opt5'}; $q4opt6 = $FORM{'q4opt6'}; $ques5 = $FORM{'ques5'}; $q5ans = $FORM{'q5ans'}; $q5opt1 = $FORM{'q5opt1'}; $q5opt2 = $FORM{'q5opt2'}; $q5opt3 = $FORM{'q5opt3'}; $q5opt4 = $FORM{'q5opt4'}; $q5opt5 = $FORM{'q5opt5'}; $q5opt6 = $FORM{'q5opt6'}; $ques6 = $FORM{'ques6'}; $q6ans = $FORM{'q6ans'}; $q6opt1 = $FORM{'q6opt1'}; $q6opt2 = $FORM{'q6opt2'}; $q6opt3 = $FORM{'q6opt3'}; $q6opt4 = $FORM{'q6opt4'}; $q6opt5 = $FORM{'q6opt5'}; $q6opt6 = $FORM{'q6opt6'}; $ques7 = $FORM{'ques7'}; $q7ans = $FORM{'q7ans'}; $q7opt1 = $FORM{'q7opt1'}; $q7opt2 = $FORM{'q7opt2'}; $q7opt3 = $FORM{'q7opt3'}; $q7opt4 = $FORM{'q7opt4'}; $q7opt5 = $FORM{'q7opt5'}; $q7opt6 = $FORM{'q7opt6'}; $ques8 = $FORM{'ques8'}; $q8ans = $FORM{'q8ans'}; $q8opt1 = $FORM{'q8opt1'}; $q8opt2 = $FORM{'q8opt2'}; $q8opt3 = $FORM{'q8opt3'}; $q8opt4 = $FORM{'q8opt4'}; $q8opt5 = $FORM{'q8opt5'}; $q8opt6 = $FORM{'q8opt6'}; $ques9 = $FORM{'ques9'}; $q9ans = $FORM{'q9ans'}; $q9opt1 = $FORM{'q9opt1'}; $q9opt2 = $FORM{'q9opt2'}; $q9opt3 = $FORM{'q9opt3'}; $q9opt4 = $FORM{'q9opt4'}; $q9opt5 = $FORM{'q9opt5'}; $q9opt6 = $FORM{'q9opt6'}; $ques10 = $FORM{'ques10'}; $q10ans = $FORM{'q10ans'}; $q10opt1 = $FORM{'q10opt1'}; $q10opt2 = $FORM{'q10opt2'}; $q10opt3 = $FORM{'q10opt3'}; $q10opt4 = $FORM{'q10opt4'}; $q10opt5 = $FORM{'q10opt5'}; $q10opt6 = $FORM{'q10opt6'}; $ques11 = $FORM{'ques11'}; $q11ans = $FORM{'q11ans'}; $q11opt1 = $FORM{'q11opt1'}; $q11opt2 = $FORM{'q11opt2'}; $q11opt3 = $FORM{'q11opt3'}; $q11opt4 = $FORM{'q11opt4'}; $q11opt5 = $FORM{'q11opt5'}; $q11opt6 = $FORM{'q11opt6'}; $ques12 = $FORM{'ques12'}; $q12ans = $FORM{'q12ans'}; $q12opt1 = $FORM{'q12opt1'}; $q12opt2 = $FORM{'q12opt2'}; $q12opt3 = $FORM{'q12opt3'}; $q12opt4 = $FORM{'q12opt4'}; $q12opt5 = $FORM{'q12opt5'}; $q12opt6 = $FORM{'q12opt6'}; $ques13 = $FORM{'ques13'}; $q13ans = $FORM{'q13ans'}; $q13opt1 = $FORM{'q13opt1'}; $q13opt2 = $FORM{'q13opt2'}; $q13opt3 = $FORM{'q13opt3'}; $q13opt4 = $FORM{'q13opt4'}; $q13opt5 = $FORM{'q13opt5'}; $q13opt6 = $FORM{'q13opt6'}; $ques14 = $FORM{'ques14'}; $q14ans = $FORM{'q14ans'}; $q14opt1 = $FORM{'q14opt1'}; $q14opt2 = $FORM{'q14opt2'}; $q14opt3 = $FORM{'q14opt3'}; $q14opt4 = $FORM{'q14opt4'}; $q14opt5 = $FORM{'q14opt5'}; $q14opt6 = $FORM{'q14opt6'}; $ques15 = $FORM{'ques15'}; $q15ans = $FORM{'q15ans'}; $q15opt1 = $FORM{'q15opt1'}; $q15opt2 = $FORM{'q15opt2'}; $q15opt3 = $FORM{'q15opt3'}; $q15opt4 = $FORM{'q15opt4'}; $q15opt5 = $FORM{'q15opt5'}; $q15opt6 = $FORM{'q15opt6'}; $ques16 = $FORM{'ques16'}; $q16ans = $FORM{'q16ans'}; $q16opt1 = $FORM{'q16opt1'}; $q16opt2 = $FORM{'q16opt2'}; $q16opt3 = $FORM{'q16opt3'}; $q16opt4 = $FORM{'q16opt4'}; $q16opt5 = $FORM{'q16opt5'}; $q16opt6 = $FORM{'q16opt6'}; $ques17 = $FORM{'ques17'}; $q17ans = $FORM{'q17ans'}; $q17opt1 = $FORM{'q17opt1'}; $q17opt2 = $FORM{'q17opt2'}; $q17opt3 = $FORM{'q17opt3'}; $q17opt4 = $FORM{'q17opt4'}; $q17opt5 = $FORM{'q17opt5'}; $q17opt6 = $FORM{'q17opt6'}; $ques18 = $FORM{'ques18'}; $q18ans = $FORM{'q18ans'}; $q18opt1 = $FORM{'q18opt1'}; $q18opt2 = $FORM{'q18opt2'}; $q18opt3 = $FORM{'q18opt3'}; $q18opt4 = $FORM{'q18opt4'}; $q18opt5 = $FORM{'q18opt5'}; $q18opt6 = $FORM{'q18opt6'}; $ques19 = $FORM{'ques19'}; $q19ans = $FORM{'q19ans'}; $q19opt1 = $FORM{'q19opt1'}; $q19opt2 = $FORM{'q19opt2'}; $q19opt3 = $FORM{'q19opt3'}; $q19opt4 = $FORM{'q19opt4'}; $q19opt5 = $FORM{'q19opt5'}; $q19opt6 = $FORM{'q19opt6'}; $ques20 = $FORM{'ques20'}; $q20ans = $FORM{'q20ans'}; $q20opt1 = $FORM{'q20opt1'}; $q20opt2 = $FORM{'q20opt2'}; $q20opt3 = $FORM{'q20opt3'}; $q20opt4 = $FORM{'q20opt4'}; $q20opt5 = $FORM{'q20opt5'}; $q20opt6 = $FORM{'q20opt6'}; $ques21 = $FORM{'ques21'}; $q21ans = $FORM{'q21ans'}; $q21opt1 = $FORM{'q21opt1'}; $q21opt2 = $FORM{'q21opt2'}; $q21opt3 = $FORM{'q21opt3'}; $q21opt4 = $FORM{'q21opt4'}; $q21opt5 = $FORM{'q21opt5'}; $q21opt6 = $FORM{'q21opt6'}; $ques22 = $FORM{'ques22'}; $q22ans = $FORM{'q22ans'}; $q22opt1 = $FORM{'q22opt1'}; $q22opt2 = $FORM{'q22opt2'}; $q22opt3 = $FORM{'q22opt3'}; $q22opt4 = $FORM{'q22opt4'}; $q22opt5 = $FORM{'q22opt5'}; $q22opt6 = $FORM{'q22opt6'}; $ques23 = $FORM{'ques23'}; $q23ans = $FORM{'q23ans'}; $q23opt1 = $FORM{'q23opt1'}; $q23opt2 = $FORM{'q23opt2'}; $q23opt3 = $FORM{'q23opt3'}; $q23opt4 = $FORM{'q23opt4'}; $q23opt5 = $FORM{'q23opt5'}; $q23opt6 = $FORM{'q23opt6'}; $ques24 = $FORM{'ques24'}; $q24ans = $FORM{'q24ans'}; $q24opt1 = $FORM{'q24opt1'}; $q24opt2 = $FORM{'q24opt2'}; $q24opt3 = $FORM{'q24opt3'}; $q24opt4 = $FORM{'q24opt4'}; $q24opt5 = $FORM{'q24opt5'}; $q24opt6 = $FORM{'q24opt6'}; $ques25 = $FORM{'ques25'}; $q25ans = $FORM{'q25ans'}; $q25opt1 = $FORM{'q25opt1'}; $q25opt2 = $FORM{'q25opt2'}; $q25opt3 = $FORM{'q25opt3'}; $q25opt4 = $FORM{'q25opt4'}; $q25opt5 = $FORM{'q25opt5'}; $q25opt6 = $FORM{'q25opt6'}; #Start our login page unless($pass eq $password){ print "Content-type: text/html\n\n"; print "Quizmaster\n"; print "\n"; print "

Quizmaster Login

\n"; print "Please submit the quizmaster password\n"; print "
\n"; print "\n"; print "\n"; print "
\n"; &endhtml; exit; } #Create our first configuration page unless($nowwhat eq "setup"){ print "Content-type: text/html\n\n"; print "Quizmaster\n"; print "\n"; print "

Quizmaster Configuration Part 1

\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
1)\ \;What is the title of your quiz??
2)\ \;Would you like to use a backround image (wallpaper),\n"; print "or a solid background color for your quiz??Image\ \;\n"; print "Color
3)\ \;What text color would you like to use??\n"; print "black
\n"; print "red
\n"; print "darkblue
\n"; print "green
\n"; print "yellow
\n"; print "white
4)\ \;What link color would you like to use??\n"; print "black
\n"; print "red
\n"; print "darkblue
\n"; print "green
\n"; print "yellow
\n"; print "white
5)\ \;What visited (vlink) color would you like to use??\n"; print "black
\n"; print "red
\n"; print "darkblue
\n"; print "green
\n"; print "yellow
\n"; print "white
6)\ \;What active (alink) color would you like to use??\n"; print "black
\n"; print "red
\n"; print "darkblue
\n"; print "green
\n"; print "yellow
\n"; print "white
7)\ \;What message would you like to use to congratulate the user upon getting 50\% or less correct??
8)\ \;What message would you like to use to congratulate the user upon getting 50 - 80\% correct??
9)\ \;What message would you like to use to congratulate the user upon getting 80\% correct or better??
10)\ \;Would you like to have the users results emailed to someone?No\ \;\n"; print "Yes
11)\ \;Quiz puts a return link at the bottom of its pages, what URL would you like to use??(Start with http://)
12)\ \;What text would you like linked to the returnlink url??
13)\ \;How many questions do you wish to have in your quiz (You may have up to 25)??

\n"; &endhtml; exit; } ##This is our second config page unless($again eq "preview"){ @names = ("pass", "title", "nowwhat", "lessthanhalf", "morethanhalf", "reallygood", "emailyesorno", "returnlinkurl", "returnlinktext", "colororimage", "textcolor", "linkcolor", "vlinkcolor", "alinkcolor", "numques"); @values = ($pass, $title, $nowwhat, $lessthanhalf, $morethanhalf, $reallygood, $emailyesorno, $returnlinkurl, $returnlinktext, $colororimage, $textcolor, $linkcolor, $vlinkcolor, $alinkcolor, $numques); print "Content-type: text/html\n\n"; print "Quizmaster\n"; print "\n"; print "

$title Configuration Part 2

\n"; print "\n"; print "\n"; $fieldcount = 0; while($fieldcount <= 15){ $getaname = shift(@names); $getavalue = shift(@values); print "\n"; ++$fieldcount; } print "\n"; if($colororimage == 0){ print "\n"; print "\n"; } else{ print "\n"; } if($emailyesorno == 1){ print "\n"; print "\n"; } $quescount = 0; while($quescount < $numques){ ++$quescount; print "\n"; print "\n"; print "\n"; print ("\n"); print "\n"; print ("\n"); } print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
What is the url of the background image (wallpaper) you'd like to use (start with http://)??
What background color would you like to use??\n"; print "black
\n"; print "red
\n"; print "darkblue
\n"; print "green
\n"; print "yellow
\n"; print "white
What is the email address of the person you'd like the quiz results mailed to??
Type question number $quescount here\.
Type the CORRECT answer to Question $quescount here\.
Type 6 more incorrect options for Question $quescount\.
\n"); print ("
\n"); print ("
\n"); print ("
\n"); print ("
\n"); print ("
Put some leading text (shows up right after the heading) here\.
Put some trailing text (shows up right at the bottom) here\.
Enter a filename for your quiz (one word, alphanumeric only please)

\n"; print "\n"; &endhtml; exit; } #Now let's preview the quiz page and give them the option of writing the page ##Check the filename the user chose, to see if it already exists $fullpathname = "$quizhtmldirectory" . "/" . "$filename" . ".html"; if(-e $fullpathname){ print "Content-type: text/html\n\n"; print "Quizmaster\n"; print "\n"; print "

OOPS!!


\n"; print "The filename you chose is already taken\, please use your browser\'s BACK button, and choose a new one\.\n"; &endhtml; exit; } ##Check the filnename for undesirable characters. if($filename =~ /\W|\.|\s/){ print "Content-type: text/html\n\n"; print "Quizmaster\n"; print "\n"; print "

OOPS!!


\n"; print "The filename you chose has some undesirable characters\, please use your browser\'s BACK button, and choose a new one\.\n"; &endhtml; exit; } unless($onemoretime eq "makepage"){ $whattodo = "confirm"; &starthtml; print "
This is exactly how your quiz will look, if you need to make any changes, you can use your browser\'s BACK button, and make them now\. You may also answer the questions, and test the Quiz\.
\n"; print "When you are sure you have everything the way you want it\, you must click the WRITE QUIZ PAGE button to create your quiz page on this server\. You\'ll be given a URL for your quiz page at that time\.
\n"; print "

$title

\n"; print "$leadingtext\n"; print "
\n"; ##Pass the variables back to the form, so they can be passed back again. @names = ("title", "filename", "whattodo", "bgimageurl", "bgcolor", "lessthanhalf", "morethanhalf", "reallygood", "emailyesorno", "email", "returnlinkurl", "returnlinktext", "colororimage", "textcolor", "linkcolor", "vlinkcolor", "alinkcolor", "numques", "q1ans", "q2ans", "q3ans", "q4ans", "q5ans", "q6ans", "q7ans", "q8ans", "q9ans", "q10ans", "q11ans", "q12ans", "q13ans", "q14ans", "q15ans", "q16ans", "q17ans", "q18ans", "q19ans", "q20ans", "q21ans", "q22ans", "q23ans", "q24ans", "q25ans"); @values = ($title, $filename, $whattodo, $bgimageurl, $bgcolor, $lessthanhalf, $morethanhalf, $reallygood, $emailyesorno, $email, $returnlinkurl, $returnlinktext, $colororimage, $textcolor, $linkcolor, $vlinkcolor, $alinkcolor, $numques, $q1ans, $q2ans, $q3ans, $q4ans, $q5ans, $q6ans, $q7ans, $q8ans, $q9ans, $q10ans, $q11ans, $q12ans, $q13ans, $q14ans, $q15ans, $q16ans, $q17ans, $q18ans, $q19ans, $q20ans, $q21ans, $q22ans, $q23ans, $q24ans, $q25ans); $fieldcount = "0"; while($fieldcount <= 43){ $getaname = shift(@names); $getavalue = shift(@values); print "\n"; ++$fieldcount; } print "\n"; print "\n"; print "\n"; #####Here are the question routines for the preview page. if($numques >= 1){ print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
Your Name: (optional)
Your Email Address: (optional)
1) $ques1\n"; } if($numques >= 2){ print "
2) $ques2\n"; } if($numques >= 3){ print "
3) $ques3\n"; } if($numques >= 4){ print "
4) $ques4\n"; } if($numques >= 5){ print "
5) $ques5\n"; } if($numques >= 6){ print "
6) $ques6\n"; } if($numques >= 7){ print "
7) $ques7\n"; } if($numques >= 8){ print "
8) $ques8\n"; } if($numques >= 9){ print "
9) $ques9\n"; } if($numques >= 10){ print "
10) $ques10\n"; } if($numques >= 11){ print "
11) $ques11\n"; } if($numques >= 12){ print "
12) $ques12\n"; } if($numques >= 13){ print "
13) $ques13\n"; } if($numques >= 14){ print "
14) $ques14\n"; } if($numques >= 15){ print "
15) $ques15\n"; } if($numques >= 16){ print "
16) $ques16\n"; } if($numques >= 17){ print "
17) $ques17\n"; } if($numques >= 18){ print "
18) $ques18\n"; } if($numques >= 19){ print "
19) $ques19\n"; } if($numques >= 20){ print "
20) $ques20\n"; } if($numques >= 21){ print "
21) $ques21\n"; } if($numques >= 22){ print "
22) $ques22\n"; } if($numques >= 23){ print "
23) $ques23\n"; } if($numques >= 24){ print "
24) $ques24\n"; } if($numques >= 25){ print "
25) $ques25\n"; } print "


\n"; print "$trailingtext\n"; ##Create our WRITE PAGE form, after the preview form. print "
\n"; ####Pass the bizillions of question variables to the WRITE PAGE form. @q1ngroup = ("ques1", "q1ans", "q1opt1", "q1opt2", "q1opt3", "q1opt4", "q1opt5", "q1opt6"); @q2ngroup = ("ques2", "q2ans", "q2opt1", "q2opt2", "q2opt3", "q2opt4", "q2opt5", "q2opt6"); @q3ngroup = ("ques3", "q3ans", "q3opt1", "q3opt2", "q3opt3", "q3opt4", "q3opt5", "q3opt6"); @q4ngroup = ("ques4", "q4ans", "q4opt1", "q4opt2", "q4opt3", "q4opt4", "q4opt5", "q4opt6"); @q5ngroup = ("ques5", "q5ans", "q5opt1", "q5opt2", "q5opt3", "q5opt4", "q5opt5", "q5opt6"); @q6ngroup = ("ques6", "q6ans", "q6opt1", "q6opt2", "q6opt3", "q6opt4", "q6opt5", "q6opt6"); @q7ngroup = ("ques7", "q7ans", "q7opt1", "q7opt2", "q7opt3", "q7opt4", "q7opt5", "q7opt6"); @q8ngroup = ("ques8", "q8ans", "q8opt1", "q8opt2", "q8opt3", "q8opt4", "q8opt5", "q8opt6"); @q9ngroup = ("ques9", "q9ans", "q9opt1", "q9opt2", "q9opt3", "q9opt4", "q9opt5", "q9opt6"); @q10ngroup = ("ques10", "q10ans", "q10opt1", "q10opt2", "q10opt3", "q10opt4", "q10opt5", "q10opt6"); @q11ngroup = ("ques11", "q11ans", "q11opt1", "q11opt2", "q11opt3", "q11opt4", "q11opt5", "q11opt6"); @q12ngroup = ("ques12", "q12ans", "q12opt1", "q12opt2", "q12opt3", "q12opt4", "q12opt5", "q12opt6"); @q13ngroup = ("ques13", "q13ans", "q13opt1", "q13opt2", "q13opt3", "q13opt4", "q13opt5", "q13opt6"); @q14ngroup = ("ques14", "q14ans", "q14opt1", "q14opt2", "q14opt3", "q14opt4", "q14opt5", "q14opt6"); @q15ngroup = ("ques15", "q15ans", "q15opt1", "q15opt2", "q15opt3", "q15opt4", "q15opt5", "q15opt6"); @q16ngroup = ("ques16", "q16ans", "q16opt1", "q16opt2", "q16opt3", "q16opt4", "q16opt5", "q16opt6"); @q17ngroup = ("ques17", "q17ans", "q17opt1", "q17opt2", "q17opt3", "q17opt4", "q17opt5", "q17opt6"); @q18ngroup = ("ques18", "q18ans", "q18opt1", "q18opt2", "q18opt3", "q18opt4", "q18opt5", "q18opt6"); @q19ngroup = ("ques19", "q19ans", "q19opt1", "q19opt2", "q19opt3", "q19opt4", "q19opt5", "q19opt6"); @q20ngroup = ("ques20", "q20ans", "q20opt1", "q20opt2", "q20opt3", "q20opt4", "q20opt5", "q20opt6"); @q21ngroup = ("ques21", "q21ans", "q21opt1", "q21opt2", "q21opt3", "q21opt4", "q21opt5", "q21opt6"); @q22ngroup = ("ques22", "q22ans", "q22opt1", "q22opt2", "q22opt3", "q22opt4", "q22opt5", "q22opt6"); @q23ngroup = ("ques23", "q23ans", "q23opt1", "q23opt2", "q23opt3", "q23opt4", "q23opt5", "q23opt6"); @q24ngroup = ("ques24", "q24ans", "q24opt1", "q24opt2", "q24opt3", "q24opt4", "q24opt5", "q24opt6"); @q25ngroup = ("ques25", "q25ans", "q25opt1", "q25opt2", "q25opt3", "q25opt4", "q25opt5", "q25opt6"); @q1vgroup = ($ques1, $q1ans, $q1opt1, $q1opt2, $q1opt3, $q1opt4, $q1opt5, $q1opt6); @q2vgroup = ($ques2, $q2ans, $q2opt1, $q2opt2, $q2opt3, $q2opt4, $q2opt5, $q2opt6); @q3vgroup = ($ques3, $q3ans, $q3opt1, $q3opt2, $q3opt3, $q3opt4, $q3opt5, $q3opt6); @q4vgroup = ($ques4, $q4ans, $q4opt1, $q4opt2, $q4opt3, $q4opt4, $q4opt5, $q4opt6); @q5vgroup = ($ques5, $q5ans, $q5opt1, $q5opt2, $q5opt3, $q5opt4, $q5opt5, $q5opt6); @q6vgroup = ($ques6, $q6ans, $q6opt1, $q6opt2, $q6opt3, $q6opt4, $q6opt5, $q6opt6); @q7vgroup = ($ques7, $q7ans, $q7opt1, $q7opt2, $q7opt3, $q7opt4, $q7opt5, $q7opt6); @q8vgroup = ($ques8, $q8ans, $q8opt1, $q8opt2, $q8opt3, $q8opt4, $q8opt5, $q8opt6); @q9vgroup = ($ques9, $q9ans, $q9opt1, $q9opt2, $q9opt3, $q9opt4, $q9opt5, $q9opt6); @q10vgroup = ($ques10, $q10ans, $q10opt1, $q10opt2, $q10opt3, $q10opt4, $q10opt5, $q10opt6); @q11vgroup = ($ques11, $q11ans, $q11opt1, $q11opt2, $q11opt3, $q11opt4, $q11opt5, $q11opt6); @q12vgroup = ($ques12, $q12ans, $q12opt1, $q12opt2, $q12opt3, $q12opt4, $q12opt5, $q12opt6); @q13vgroup = ($ques13, $q13ans, $q13opt1, $q13opt2, $q13opt3, $q13opt4, $q13opt5, $q13opt6); @q14vgroup = ($ques14, $q14ans, $q14opt1, $q14opt2, $q14opt3, $q14opt4, $q14opt5, $q14opt6); @q15vgroup = ($ques15, $q15ans, $q15opt1, $q15opt2, $q15opt3, $q15opt4, $q15opt5, $q15opt6); @q16vgroup = ($ques16, $q16ans, $q16opt1, $q16opt2, $q16opt3, $q16opt4, $q16opt5, $q16opt6); @q17vgroup = ($ques17, $q17ans, $q17opt1, $q17opt2, $q17opt3, $q17opt4, $q17opt5, $q17opt6); @q18vgroup = ($ques18, $q18ans, $q18opt1, $q18opt2, $q18opt3, $q18opt4, $q18opt5, $q18opt6); @q19vgroup = ($ques19, $q19ans, $q19opt1, $q19opt2, $q19opt3, $q19opt4, $q19opt5, $q19opt6); @q20vgroup = ($ques20, $q20ans, $q20opt1, $q20opt2, $q20opt3, $q20opt4, $q20opt5, $q20opt6); @q21vgroup = ($ques21, $q21ans, $q21opt1, $q21opt2, $q21opt3, $q21opt4, $q21opt5, $q21opt6); @q22vgroup = ($ques22, $q22ans, $q22opt1, $q22opt2, $q22opt3, $q22opt4, $q22opt5, $q22opt6); @q23vgroup = ($ques23, $q23ans, $q23opt1, $q23opt2, $q23opt3, $q23opt4, $q23opt5, $q23opt6); @q24vgroup = ($ques24, $q24ans, $q24opt1, $q24opt2, $q24opt3, $q24opt4, $q24opt5, $q24opt6); @q25vgroup = ($ques25, $q25ans, $q25opt1, $q25opt2, $q25opt3, $q25opt4, $q25opt5, $q25opt6); $fieldcount = "0"; @names = ("leadingtext", "trailingtext", "again", "pass", "nowwhat", "title", "filename", "whattodo", "bgimageurl", "bgcolor", "lessthanhalf", "morethanhalf", "reallygood", "emailyesorno", "email", "returnlinkurl", "returnlinktext", "colororimage", "textcolor", "linkcolor", "vlinkcolor", "alinkcolor", "numques", @q1ngroup, @q2ngroup, @q3ngroup, @q4ngroup, @q5ngroup, @q6ngroup, @q7ngroup, @q8ngroup, @q9ngroup, @q10ngroup, @q11ngroup, @q12ngroup, @q13ngroup, @q14ngroup, @q15ngroup, @q16ngroup, @q17ngroup, @q18ngroup, @q19ngroup, @q20ngroup, @q21ngroup, @q22ngroup, @q23ngroup, @q24ngroup, @q25ngroup); @values = ($leadingtext, $trailingtext, $again, $pass, $nowwhat, $title, $filename, $whattodo, $bgimageurl, $bgcolor, $lessthanhalf, $morethanhalf, $reallygood, $emailyesorno, $email, $returnlinkurl, $returnlinktext, $colororimage, $textcolor, $linkcolor, $vlinkcolor, $alinkcolor, $numques, @q1vgroup, @q2vgroup, @q3vgroup, @q4vgroup, @q5vgroup, @q6vgroup, @q7vgroup, @q8vgroup, @q9vgroup, @q10vgroup, @q11vgroup, @q12vgroup, @q13vgroup, @q14vgroup, @q15vgroup, @q16vgroup, @q17vgroup, @q18vgroup, @q19vgroup, @q20vgroup, @q21vgroup, @q22vgroup, @q23vgroup, @q24vgroup, @q25vgroup); while($fieldcount <= 245){ $getaname = shift(@names); $getavalue = shift(@values); print "\n"; ++$fieldcount; } print "\n"; print "

\n"; &endhtml; exit; } ##Give the user an error message if something goes wrong with creating ##their HTML file. if($onemoretime eq "makepage"){ $fullpathname = "$quizhtmldirectory" . "/" . "$filename" . ".html"; unless(open(HTML, ">$fullpathname")){ &starthtml; print "

OOPS!!!


There was a problem creating your file, you may wish to try again in a few minutes, or contact someone responsible for this site\.\n"; &endhtml; exit; } ##Write the HTML to the file if ($colororimage eq "0"){ $backgroundtag = "BACKGROUND\=$bgimageurl"; $bgcolortag = ""; } else { $backgroundtag = ""; $bgcolortag = "BGCOLOR\=$bgcolor"; } print HTML "$title\n"; print HTML "\n"; print HTML "

$title

\n"; print HTML "$leadingtext\n"; print HTML "
\n"; $whattodo = "confirm"; @names = ("title", "whattodo", "bgimageurl", "bgcolor", "lessthanhalf", "morethanhalf", "reallygood", "emailyesorno", "email", "returnlinkurl", "returnlinktext", "colororimage", "textcolor", "linkcolor", "vlinkcolor", "alinkcolor", "numques", "q1ans", "q2ans", "q3ans", "q4ans", "q5ans", "q6ans", "q7ans", "q8ans", "q9ans", "q10ans", "q11ans", "q12ans", "q13ans", "q14ans", "q15ans", "q16ans", "q17ans", "q18ans", "q19ans", "q20ans", "q21ans", "q22ans", "q23ans", "q24ans", "q25ans"); @values = ($title, $whattodo, $bgimageurl, $bgcolor, $lessthanhalf, $morethanhalf, $reallygood, $emailyesorno, $email, $returnlinkurl, $returnlinktext, $colororimage, $textcolor, $linkcolor, $vlinkcolor, $alinkcolor, $numques, $q1ans, $q2ans, $q3ans, $q4ans, $q5ans, $q6ans, $q7ans, $q8ans, $q9ans, $q10ans, $q11ans, $q12ans, $q13ans, $q14ans, $q15ans, $q16ans, $q17ans, $q18ans, $q19ans, $q20ans, $q21ans, $q22ans, $q23ans, $q24ans, $q25ans); $fieldcount = "0"; while($fieldcount <= 42){ $getaname = shift(@names); $getavalue = shift(@values); print HTML "\n"; ++$fieldcount; } print HTML "\n"; print HTML "\n"; print HTML "\n"; if($numques >= 1){ print HTML "\n"; print HTML "\n"; print HTML "\n"; print HTML "\n"; print HTML "\n"; print HTML "\n"; print HTML "\n"; print HTML "\n"; print HTML "\n"; print HTML "\n"; print HTML "\n"; print HTML "\n"; print HTML "\n"; print HTML "\n"; print HTML "\n"; print HTML "\n"; print HTML "\n"; print HTML "\n"; print HTML "\n"; print HTML "\n"; print HTML "\n"; print HTML "\n"; print HTML "\n"; print HTML "\n"; print HTML "\n"; print HTML "
Your Name: (optional)
Your Email Address: (optional)
1) $ques1\n"; } if($numques >= 2){ print HTML "
2) $ques2\n"; } if($numques >= 3){ print HTML "
3) $ques3\n"; } if($numques >= 4){ print HTML "
4) $ques4\n"; } if($numques >= 5){ print HTML "
5) $ques5\n"; } if($numques >= 6){ print HTML "
6) $ques6\n"; } if($numques >= 7){ print HTML "
7) $ques7\n"; } if($numques >= 8){ print HTML "
8) $ques8\n"; } if($numques >= 9){ print HTML "
9) $ques9\n"; } if($numques >= 10){ print HTML "
10) $ques10\n"; } if($numques >= 11){ print HTML "
11) $ques11\n"; } if($numques >= 12){ print HTML "
12) $ques12\n"; } if($numques >= 13){ print HTML "
13) $ques13\n"; } if($numques >= 14){ print HTML "
14) $ques14\n"; } if($numques >= 15){ print HTML "
15) $ques15\n"; } if($numques >= 16){ print HTML "
16) $ques16\n"; } if($numques >= 17){ print HTML "
17) $ques17\n"; } if($numques >= 18){ print HTML "
18) $ques18\n"; } if($numques >= 19){ print HTML "
19) $ques19\n"; } if($numques >= 20){ print HTML "
20) $ques20\n"; } if($numques >= 21){ print HTML "
21) $ques21\n"; } if($numques >= 22){ print HTML "
22) $ques22\n"; } if($numques >= 23){ print HTML "
23) $ques23\n"; } if($numques >= 24){ print HTML "
24) $ques24\n"; } if($numques >= 25){ print HTML "
25) $ques25\n"; } print HTML "


\n"; print HTML "$trailingtext\n"; close(HTML); #Give the user a response, and a link back to his/her quiz page. &starthtml; print "OK..your quiz page was created\, this is the url\:
\n"; print ("" . "$quizhtmldirectoryurl" . "/" . "$filename" . ".html
"); print "Thanks for using QUIZMASTER!!\n"; &endhtml; exit; } # A couple of basic subroutines, because I'm Lazy. sub starthtml { if ($colororimage eq "0"){ $backgroundtag = "BACKGROUND\=$bgimageurl"; $bgcolortag = ""; } else { $backgroundtag = ""; $bgcolortag = "BGCOLOR\=$bgcolor"; } print "Content-type: text/html\n\n"; print "$title\n"; print "\n"; } #here's another sub endhtml { print ""; }