#!/usr/bin/perl
use strict;
use CGI::Pretty qw/:standard :html3 *table/;
use DBI;
require "config.pl";
our ($DBHost,$DBName,$DBUser,$DBPass,$owneremail,$ownerdesc,$sendmail);
our ($dbh);
# # # # # # # # # # # # # # # # # # #
# Functions
# # # # # # # # # # # # # # # # # # #
sub print_error{
print_header('BizInc USA - Internal Site Error');
print<<"HTML";
|
Site Software ERROR!
|
|
HTML
foreach (@_){
print "| $_ |
\n";
}
print<<"HTML";
|
|
Please report to
$owneremail
|
HTML
print_footer();
}
sub db_connect{
$dbh = DBI->connect("dbi:mysql:dbname=$DBName;host=$DBHost","$DBUser","$DBPass",
{
PrintError => 0,
RaiseError => 0,
AutoCommit => 1
});
if (!defined($dbh)){
print_error("Database Error:","$DBI::errstr");
exit(1);
}
}
sub db_disconnect{
if ($dbh){
$dbh->disconnect();
}
}
sub print_header{
print<<"HTML";
Content-type:text/html
$_[0]
HTML
}
sub print_footer{
print<<"HTML";
HTML
}
sub beautify{
if($_[0] < 10 && $_[0] >= 0){
return("0".$_[0]);
}
else {
return($_[0]);
}
}
return(1);