#!/usr/bin/perl -w use CGI qw(:standard -debug); use CGI::Pretty ":standard"; use CGI::Carp qw(fatalsToBrowser); ########### Credits ################# # Script written by R. Todd Vandenbark ##################################### #----------- define variables ---------- my $inuser; # username entered my $inpass; # password entered my $cookie_user; # username cookie my $cookie_pwd; # username passwd my $bsuname; # bsu id my $username; # staff sys user id my $passwd; # staff sys password my $found=0; # when found my @filestuff; # holds input file my @formstuff; # holds form input # -------- read in password file -------- my $inputFile = "../staff.txt"; open (IN, $inputFile) || die "Can't open $inputFile: $!\n"; @filestuff = ; chomp(@filestuff); close IN; $inuser=cookie('studylog_username'); $inpass=cookie('studylog_passwd'); if (!$inuser || !$inpass) { # ---- get username & password entered ---- $inuser = param("username"); chomp $inuser; $inpass = param("passwd2"); chomp $inpass; } # ---- search for match ------------------ foreach $key (@filestuff) { ($bsuname,$username,$passwd) = split (/:/, $key); if ( ($inuser eq $username) && ($inpass eq $passwd) ) { $found++; } # end if } # ---- end foreach ____ if (!$found) { # if no match, present error message $title = "Invalid entry"; $content = '

Please go back and try again

'; } # ------- end if ------ else { # ------ match ---------- $cookie_user = cookie(-name => 'studylog_username', -expires => "+1h", -value => $inuser ); $cookie_pwd = cookie(-name => 'studylog_passwd', -expires => "+1h", -value => $inpass ); $logo = ''; $title = "Staff System"; $content = '

Main Menu

Manual student login New organization contact
Reports Update contact info
Manage staff accounts Delete organization contact
'; } # --------end else ----- &pgprint; # ------ print page ------- sub pgprint { my $css = ''; print header(-cookie => [$cookie_user, $cookie_pwd]); print start_html (-title => $title, -head => $css, -class => 'oneColFixCtrHdr'); print '
' . "\n"; print '
' . "\n"; print "$content \n"; print <
Report a problem.
Help function EOF print '
'. ''. '
'; print end_html(); } # ------ end sub --------