#!/util/bin/perl ############################################################################## #Copyright by Siyuan Liu # ############################################################################## #File receives and verifies password with existing registration information, # #if the password is valid, it seizes information from grade file and report # #it to user. # ############################################################################## # Set Variables $mainmenuurl = "http://wings.buffalo.edu/ees/faculty/rabideau/eas308.html"; $registerurl = "http://wings.buffalo.edu/ees/faculty/rabideau/class/register.html"; $gradesurl = "http://wings.buffalo.edu/ees/faculty/rabideau/class/grades.html"; $registertxtreal = "/net/wings/info/www/academic/department/eng/cie/ees/faculty/rabideau/class/register.txt"; $gradereal= "/net/wings/info/www/academic/department/eng/cie/ees/faculty/rabideau/class/grade.prn"; $log = "/net/wings/info/www/academic/department/eng/cie/ees/faculty/rabideau/class/log.txt"; $cgiurl = "http://wings.buffalo.edu/ees/faculty/rabideau/cgi-bin/register.cgi"; $date_command = "/bin/date"; # Set Your Options: $mail = 0; # 1 = Yes; 0 = No $uselog = 1; # 1 = Yes; 0 = No $linkmail = 1; # 1 = Yes; 0 = No $separator = 1; # 1 =
; 0 =

$entry_order = 1; # 1 = Newest entries added first; # 0 = Newest Entries added last. $remote_mail = 0; # 1 = Yes; 0 = No $allow_html = 1; # 1 = Yes; 0 = No $line_breaks = 0; # 1 = Yes; 0 = No # If you answered 1 to $mail or $remote_mail you will need to fill out # these variables below: $mailprog = '/usr/ucb/mail'; $recipient = 'siliu@acsu.buffalo.edu'; # Done ############################################################################## # Get the Date for Entry $date = `$date_command +"%A, %B %d, %Y at %T (%Z)"`; chop($date); $shortdate = `$date_command +"%D %T %Z"`; chop($shortdate); # Get the input read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # Split the name-value pairs @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); # Un-Webify plus signs and %-encoding $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s///g; if ($allow_html != 1) { $value =~ s/<([^>]|\n)*>//g; } $FORM{$name} = $value; } $FORM{'passwd'}=~ tr/a-z/A-Z/; # Verify Password with Registration Information File open (FILE,"$registertxtreal") || die "Can't Open $registertxtreal: $!\n"; @LINES=; $SIZE=@LINES; $match=0; for ($i=0;$i<=$SIZE;$i++) { @person=split(/ +/,$LINES[$i]); $person[0]=~ tr/a-z/A-Z/; $master=GODZILLA; if($person[0] eq $FORM{'passwd'}) { $match=1; $ID=$person[2]; @individual=@person; } elsif($master eq $FORM{'passwd'}) { #User is at Master Level Access: Complete Information Report & Downloading Option #Lookup Information from Grade File open(grade,"$gradereal") || die "Can't Open $gradereal: $!\n"; @LINES=; close(grade); $SIZE=@LINES; @average=split(/ +/,$LINES[$SIZE-2]); @sdeviation=split(/ +/,$LINES[$SIZE-1]); print "Content-type: text/html\n\n"; print "Grades Report\n"; print "

Grades Report


\n"; print 'Download grade file in Excel format.'; print "
\n"; for ($j=0;$j<=$SIZE-3;$j++) { @record=split(/ +/,$LINES[$j]); #Out-put for grades-report table if($j%10 eq 0) { print ''; print ""; print ""; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print ''; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print ''; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print ''; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
NAMESHW#1HW#2HW#3HW#4HW#5HW#6MidtermGRADE
$record[1]$record[2]$record[3]$record[4]$record[5]$record[6]$record[7]$record[8]$record[9]
Class Average$average[2]$average[3]$average[4]$average[5]$average[6]$average[7]$average[8]$average[9]
Standard Deviation$sdeviation[2]$sdeviation[3]$sdeviation[4]$sdeviation[5]$sdeviation[6]$sdeviation[7]$sdeviation[8]$sdeviation[9]
\n"; print " - $date

\n"; # Print End of HTML print "


\n"; print "Back to the main menu\n"; print "\n"; exit; #Master Level Access Routine Completed. } } if ($match==0){ print "Content-type: text/html\n\n"; print "ERROR In Processing Your Password\n"; print "

ERROR In Processing Your Password


\n"; print "Invalid Password:
\n"; print "