#!C:/perl/bin/perl.exe use CGI::Carp qw(fatalsToBrowser); use CGI; $query = new CGI; $pin= $query->param('pin'); $password= $query->param('password'); $pass= $query->param('pass'); print $query->header; print $query->start_html(-title=>'Login'); print " \n\n"; #----------------------------------- # Check login status #----------------------------------- open(INFO, "$ENV{'DOCUMENT_ROOT'}/www/P593/data/userlist.txt"); @passdata = ; close(INFO); $match = 0; foreach $key (@passdata){ @a=split(/,/,$key); if( $a[0] eq $pin && $a[1] eq $password){ $match=1; } } if($match !=1){ print "We cannot find a record of either that user name ($pin) or password.

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

"; } #----------------------------------- # Present standard study script within match == 1 braces #----------------------------------- if($match == 1){ $pass = $pass + 1; print "The study would appear here just like normal. The only difference is the code that checks the login status. In addition, if the survey involves multiple pages, the \$pin and \$password must be passed forward on each page in hidden tags. Otherwise, the user will be blocked from the site as soon as he or she presses submit the first time. The data would be saved as the last step and then the user would be taken to a 'thank you' page.

"; print "
Here is question number $pass

"; print ""; print ""; print ""; print ""; print "
"; }