## Global Links package common::links; use strict; #use CGI::Carp qw(fatalsToBrowser); #warn "this is a complaint"; #die "But this is serious"; use vars qw ($timeclock_link $searchform_link); $timeclock_link = "timeclock.cgi"; $searchform_link = "search_form.cgi"; ## Global Authentication Variables package common::auth; use vars qw($user $admin); $user = $ENV{"REMOTE_USER"}; $admin = "admin"; # Set to the Administrators username ########################################## ## Authentication Error ########################################## sub print_error{ print < Error

Authentication Failed. Please Restart your Browser.


HTML } # End of print_results subroutine ########################################## ## Create a connection to the database. ## ########################################## package common::sql; use vars qw($sth $dbh); sub Create_DB_Connection{ use DBI; use DBD::Pg; my ($DSN, $db_user, $pw); $DSN = "DBI:Pg:dbname=user"; $db_user = "user"; $pw = "resu"; #$dbh = DBI->connect($DSN,$db_user,$pw, { RaiseError => 1 }) $dbh = DBI->connect($DSN,$db_user,$pw, { PrintError => 1 }) || die "Cannot connect: $DBI::errstr\n" unless $dbh; return; } # End of Create_DB_Connection subroutine. ########################################## ########################################## ## Executes the SQL command and then ## ## returns to the calling area of the ## ## program. ## ########################################## sub Do_SQL{ eval{ $sth = $dbh->prepare($main::SQL); }; # End of eval # Check for errors. if($@){ $dbh->disconnect; print "Content-type: text/html\n\n"; print "An ERROR occurred! $@\n

"; exit; } else { $sth->execute; } # End of if..else return ($sth); } # End of Do_SQL subroutine ################################################################# #################################### ### Filter - Gets rid of ### ### characters that screw up the ### ### program. ### #################################### sub filter{ $_[0]=~s/\'/\\\'/g; return $_[0]; } # End of filter subroutine ################################################################# 1; # Required or won't work!