#!C:/perl/bin/perl.exe use CGI; $query = new CGI; print $query->header; print $query->start_html(-title=>'Password demo'); print ""; #-------------------------------------------- $pin= $query->param('pin'); $password= $query->param('password'); $match= 0; $v0 = "Background Information"; $v1 = "Political Attitudes"; $v2 = "Personality"; $v3 = "Relationships"; $numsurveys= 4; #-------------------------------------------- open(INFO, "$ENV{'DOCUMENT_ROOT'}/data/passwords.txt"); @passdata = ; close(INFO); #-------------------------------------------- foreach $key (@passdata) { ($pin2,$storedpassword,$e)=split(/,/,$key); if( ($pin eq $pin2) && ($password eq $storedpassword) ) { $match= 1; } } #-------------------------------------------- if ($match == 0) { print "Invalid response.

"; print "If you think you may have made a typo, please click your browser's Back button and try again.

"; } #-------------------------------------------- if ($match == 1) { print "Survey Menu

"; open(INFO, "$ENV{'DOCUMENT_ROOT'}/data/participation.txt"); @participation = ; close(INFO); $tasks = 0; @dates = (); foreach $key (@participation) { ($pin2,$section,$date)=split(/,/,$key); if($pin2 eq $pin) { $tasks= $tasks + 1; @dates = (@dates, $date); } } print ""; print ""; for($i = 0; $i <= ($numsurveys - 1); ++$i) { $listing = "v" . $i; print ""; if($i < $tasks){ print ""; } else{ print ""; } print ""; } print "
Survey Status
$$listingCompleted on $dates[$i]Not completed
"; if($tasks < $numsurveys){ $nextaction = "/cgi-bin/" . "pindemosurvey" . $tasks . ".pl"; print "
"; print ""; print ""; print "
You have completed $tasks of the 4 surveys. Please click the button below to take the next survey.
"; print ""; print "
"; } if($tasks >= $numsurveys){ print "
You have completed all the questionnaires.

Debriefing."; } } print $query->end_html;