#!/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 =
$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= \n";
# Print End of HTML
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 '
\n";
print " - $date';
print " \n";
}
print 'NAMES ";
print "HW#1 ";
print "HW#2 \n";
print "HW#3 \n";
print "HW#4 \n";
print "HW#5 \n";
print "HW#6 \n";
print "Midterm \n";
print "GRADE \n";
print "';
print " \n";
}
print '$record[1] \n";
print "$record[2] \n";
print "$record[3] \n";
print "$record[4] \n";
print "$record[5] \n";
print "$record[6] \n";
print "$record[7] \n";
print "$record[8] \n";
print "$record[9] \n";
print "';
print " \n";
print 'Class Average \n";
print "$average[2] \n";
print "$average[3] \n";
print "$average[4] \n";
print "$average[5] \n";
print "$average[6] \n";
print "$average[7] \n";
print "$average[8] \n";
print "$average[9] \n";
print "';
print " \n";
print "Standard Deviation \n";
print "$sdeviation[2] \n";
print "$sdeviation[3] \n";
print "$sdeviation[4] \n";
print "$sdeviation[5] \n";
print "$sdeviation[6] \n";
print "$sdeviation[7] \n";
print "$sdeviation[8] \n";
print "$sdeviation[9] \n";
print "
\n";
print "Back to the main menu\n";
print "