##################################################### ##common.sub ## ## This file contains subroutines and ## variables ## ## that are used in multiple ##scripts. ## ## Configure what is ##needed. ## ##################################################### ## Authentication Variables #my ($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. ## ########################################## sub Create_DB_Connection{ use DBI; use DBD::Pg; my ($DSN, $db_user, $pw); $DSN = "DBI:Pg:dbname=yaya"; $db_user = "yaya"; $pw = "yayapwd"; $dbh = DBI->connect($DSN,$db_user,$pw, { RaiseError => 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{ #my $sth; $sth = $dbh->prepare($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!