#!C:/perl/bin/perl.exe use CGI::Carp qw(fatalsToBrowser); use CGI; $query = new CGI; print $query->header; print $query->start_html(-title=>'eStyles'); print " \n\n"; $pin= $query->param('pin'); $password= $query->param('password'); # ---- check password --- open(INFO, "$ENV{'DOCUMENT_ROOT_OLD'}/www/relationshipsresearch.com/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.

"; } if ($match == 1){ open(INFO, "$ENV{'DOCUMENT_ROOT_OLD'}/www/relationshipsresearch.com/P593/data/$pin-participation.txt"); @participation = ; close(INFO); print "
You are logged in as $pin.

Complete a survey

"; #----------attempts---------- # Get date and time of logins ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $year = 1900 + $year; $mon= $mon+1; $hour = $hour-1; $ampm = "a.m."; if($hour > 12){ $hour= $hour - 12; $ampm = "p.m."; } $date1= "$mon/$mday/$year"; $date2= "$hour:$min" . "-" . "$ampm"; # print info in participation log text file open(INFO, ">>$ENV{'DOCUMENT_ROOT_OLD'}/www/relationshipsresearch.com/P593/data/participationlog.txt"); print INFO "$pin,$password,$date1,$date2,endline\n"; close(INFO); # open the participation log text file open(INFO, "$ENV{'DOCUMENT_ROOT_OLD'}/www/relationshipsresearch.com/P593/data/participationlog.txt"); @participationlog = ; close(INFO); # print for user the number of times taken and the dates taken $timesTaken = 0; foreach $key (@participationlog){ @a=split(/,/,$key); if( $a[0] eq $pin && $a[1] eq $password){ $timesTaken = $timesTaken + 1; } } print "You have logged into this site $timesTaken times.

"; print "Your login dates are:
"; foreach $key (@participationlog){ @a=split(/,/,$key); if( $a[0] eq $pin && $a[1] eq $password){ print "@a[2]
"; } } #----------end attempts---------- print "

"; print "
Please click the button above to take the next survey.

"; print ""; print ""; print ""; } # end match = 1 print $query->end_html;