#!/usr/bin/perl -w #--------------------------------------------------------------- # Study Log: Check Student ID CGI # By Michael Pierce and modified by Crystal White and Todd Vandenbark # April 4, 2009 (last modified April 23, 2009) # Task: # -Page where student's id, name, and greek house is displayed # -put informtion in the student.txt file if correct #!/usr/bin/perl -w #--------------------------------------------------------------- # Study Log: Check Student ID CGI # By Michael Pierce and modified by Crystal White and Todd Vandenbark # April 4, 2009 (last modified April 23, 2009) # Task: # -Page where student's id, name, and greek house is displayed # -put informtion in the student.txt file if correct # -print out Main Menu page # -use cookies to maintain the state of pages # Input: ID number # Output: Student's information to student.txt, main menu page #--------------------------------------------------------------- use CGI qw(:standard -debug); use CGI::Carp qw(fatalsToBrowser); # --- retrieve cookie ---------------------------------- # $cookiedata=cookie('id'); # Set stylesheet $css = ''; # File for Student Information $stf= "../student.txt"; # HTML form $form1= "http://studylog.firesidelibrarian.com/cgi/submitHouse.cgi"; $form2= "http://studylog.firesidelibrarian.com/faq.htm"; # read in file if (-r $stf) { # read in file open(IN,$stf) || die "can't read $stf"; @sts = ; close IN; chomp @sts; # %pws : key=ID, value=name foreach $key (@sts) { ($idnum,$user,$first,$last,$session) = split(/:/,$key); } # end foreach } # get input $newuser = param("newuser"); open (OUT, ">>$stf") || die "can't append to $stf"; print OUT "$newuser\n"; close (OUT); #Print HTML for Student Log Main Menu $title = "Study Log Main Menu"; $content ='

' . "\n" . '

' . "\n" . '
'. '
' . "\n" . '
' . "\n". '
' . "\n" .'

'. '

Help

'; &pgprint(); sub pgprint { print header(); print start_html(-title=>$title, -head =>$css); print ' '; print '
'; print h2("$subtitle"); print "$content\n"; print '
' . "\n"; print ''. "\n" . ''. "\n" . '' . "\n"; print end_html(); }