#!/usr/bin/perl
#
$|=1;
#############################################################
#Set Location of Files here
my $path_cgi = "k.cgi";
my $path_html = "kiosk.html";
##############
######### Begin procedures:
BEGIN
{
### Production
push @INC, "/usr/local/ahacb/utility/perl-lib";
push @INC, "/usr/local/ahacb/billing/perl-lib";
# TEST
#push @INC, "/usr/local/systemtest/utility/perl-lib";
#push @INC, "/usr/local/systemtest/billing/perl-lib";
$ENV{ORACLE_HOME}="/local/oracle/product/8.1.5";
$ENV{DEBUG} = 0;
};
### USE Modules
use DBI;
use util;
require "ahalib.pl";
############################################################################
local $dbh=&dbhconnect;
my %input;
my %urlstring;
$input{'whattodo'}='';
$input{'acct_code'}='';
$input{'card_lname'}='';
$input{'card_fname'}='';
$input{'card_address1'}='';
$input{'card_address2'}='';
$input{'card_city'}='';
$input{'card_zip'}='';
$input{'card_number'}='';
$input{'email'}='';
$input{'phone'}='';
$input{'fax'}='';
$input{'mem_number'}='';
my $replace_string='';
print "Content-type: text/html\n\n";
if (($ENV{'REQUEST_METHOD'} eq "GET") && ($ENV{'QUERY_STRING'} ne '')) {
$_ = $ENV{'QUERY_STRING'};
}
elsif ($ENV{'REQUEST_METHOD'} eq "POST") {
read(STDIN,$_, $ENV{'CONTENT_LENGTH'});
}
foreach my $pair (split('&')) {
if ($pair =~ /(.*)=(.*)/) { #found key=value;#
(my $key,my $value) = ($1,$2); #get key, value
$_ = $value;
s/%(..)/pack('c',hex($1))/eg;
$value = $_;
$value =~ s/\+/ /g; #substitue spaces for + sign
$input{$key} = $value; #Create Associative Array
}
}
if ($ENV{'QUERY_STRING'} ne'')
{
$_ = $ENV{'QUERY_STRING'};
foreach my $pair (split('&')) {
if ($pair =~ /(.*)=(.*)/) { #found key=value;#
(my $key,my $value) = ($1,$2); #get key, value
$_ = $value;
s/%(..)/pack('c',hex($1))/eg;
$value = $_;
$value =~ s/\+/ /g; #substitue spaces for + sign
$urlstring{$key} = $value; #Create Associative Array
}
}
if($input{acct_code})
{
my($ret_val,$err_str) = &update_visitor_count($input{acct_code});
$ENV{DEBUG} && print "
update_visitor_count returned $ret_val,$err_str
\n";
}
foreach my $key1(sort(keys (%urlstring)))
{
if ($key1 ne '' && ($key1 !~/[Aa][Cc][Cc][Tt]_[Cc][Oo][Dd][Ee]/ || $key1 ne 'p'))
{
$replace_string .= "\n";
}
}
if($input{'mem_number'} != null)
{
my ($ret_code,$fname,$lname,$address1,$address2,$city,$state,$zip,$email,$phone,$fax);
my $member_id = $input{'mem_number'};
$member_id =~ s/\/$//g;
$input{'mem_number'} = $member_id;
($ret_code,$fname,$lname,$address1,$address2,$city,$state,$zip,$email,$phone,$fax) = &pre_pop_data($member_id);
if($ret_code != 0)
{
print "Invalid account or account is already active..$ret_code\n";
$dbh->disconnect;
exit;
}
$input{'card_lname'}=$lname;
$input{'card_fname'}=$fname;
$input{'card_address1'}=$address1;
$input{'card_address2'}=$address2;
$input{'card_city'}=$city;
$input{'card_zip'}=$zip;
$input{'email'}=$email;
$input{'phone'}=$phone;
$input{'fax'}=$fax;
}
}
if ($input{'p'} ne '')
{
$path_html="$input{'p'}.html";
}
else
{
$path_html="kiosk.html";
}
if (($input{'card_zip'} ne '') && ($input{'whattodo'} ne 'cancel'))
{
### get the state and city
($input{'card_city'},$input{'card_state'})=getCityState($input{'card_zip'});
if (! defined $input{'card_city'})
{
$input{'card_city'}="