#!/usr/local/bin/perl # mymod.pm package mymod; use CGI qw(:all); use DBI; require Exporter; @ISA = qw(Exporter); @EXPORT = qw(); @EXPORT_OK = qw(dbconnect dienice isadmin getprivilege $cwd $remoteuser $servername); # Database include script print header; # Get current working directory $servername = $ENV{'SERVER_NAME'}; $scriptname = $ENV{'SCRIPT_FILENAME'}; @a = split/\//,$scriptname; pop(@a); # removes the name of the file at the end. $cwd = join '/',@a; $cwd = $cwd . '/'; ####################### if ($servername eq "localhost"){ # Define remote user if working locally $remoteuser = 'me'; $file = 'E:/WAIWeb/mysql_login.txt'; } elsif ($servername eq "www.wilcoxassoc.com"){ # Define remote user when on production server $remoteuser = $ENV{'REMOTE_USER'}; $file = '/var/www/mysql_login.txt'; } else { foreach $key (sort(keys %ENV)){ print ("
$key = $ENV{$key}"); } &dienice("Could not connect to unknown servername of: $servername"); }