#!/usr/bin/perl
if ($port)
{
$ENV{"MYSQL_TCP_PORT"}=$port;
}
if ($sock)
{
$ENV{"MYSQL_UNIX_PORT"}="$sock";
}
use Mysql; # use the Mysql Perl Adaptor
require "cgi-lib.pl"; # Form processing library
require "cgi-lib.sol"; # Additional dunctions library
require "mail-lib.pl"; # UNIX sendmail processing library
require "library_func.pl";
require "cookie.lib";
$dbh = Mysql->Connect("$host","$mercantor_database","$user", "$pass");
&ReadParse; #subroutine from cgi-lib.pl for parsing form variables into the %in associative array
print "Content-type: text/html;\n";
if ($in{'store_id'})
{
@store_id = split(/,/, $in{'store_id'});
} else {
die;
}
@host = ("", "Shared", "VDS");
@host_type = ("", "20.00", "30.00");
$selection = "";
$cycle = 0 if ($store_id[2] == 1);
$cycle = 1 if ($store_id[2] == 6);
$cycle = 2 if ($store_id[2] == 12);
$cycle = 3 if ($store_id[2] == 24);
$hostsel = "
" if (substr($store_id[0], 0, 1) eq "1");
$hostsel = "
" if (substr($store_id[0], 0, 1) eq "2");
if ( substr($store_id[0], 0, 1) eq "1")
{
@rates = (0, 0, 6.00, 4.80) if ($store_id[1] == 1);
@rates = (0, 13, 10.00, 8.80) if ($store_id[1] == 2);
@rates = (0, 30.00, 20.00, 18.00) if ($store_id[1] == 3);
@rates = (0, 50.00, 40.00, 35.00) if ($store_id[1] == 4);
}
if ( substr($store_id[0], 0, 1) eq "2")
{
@rates = (60.00, 50.00, 40.00, 35.00) if ($store_id[1] == 1);
@rates = (100.00, 80.00, 75.00, 70.00) if ($store_id[1] == 2);
@rates = (150.00, 120.00, 110.00, 100.00) if ($store_id[1] == 3);
@rates = (250.00, 200.00, 190.00, 180.00) if ($store_id[1] == 4);
}
@fields = ("name", "company", "address1", "address2", "city", "postalcode", "state", "country", "email", "telephone", "fax", "handphone");
foreach $itemf (@fields)
{
$class{$itemf} = "forma";
}
if ($in{'_verac'})
{
$mail_msg = "";
foreach $field (@fields)
{
$in{ $field } = retraitement( $in{ $field } );
$mail_msg .= " $field => $in{ $field }
" if ($in{ $field });
}
}
if ($in{'_verac'})
{
$notpass_ = 0;
@req = ("name", "address1", "postalcode", "country", "email", "telephone");
foreach $requesite (@req)
{
$notpass_ = 1 if ( ! $in{ $requesite });
$class{ $requesite } = "forma2" if ( ! $in{ $requesite } );
}
if ($notpass_ == 0 )
{
open (MAIL, "|/usr/sbin/sendmail -t") ||
&web_error("Could Not Open Mail Program");
print MAIL <<__END_OF_MAIL__;
to: forstock\@pacific.net.sg
from: thierry\@it2000.net
subject: [CYBERLOGON] Hosting Package Request
content-type: text/html; charset=us-ascii
$mail_msg
| Hosting | $host[ substr($store_id[0], 0, 1) ]
|
| Monthly | S\$ $rates[$cycle]
|
| Setup Fee | S\$ $host_type[ substr($store_id[0], 0, 1) ]
|
| Billing Cycle | $store_id[2] months
|
__END_OF_MAIL__
close (MAIL);
print ("Location: inwww_order_conf.acv\n\n");
die;
}
}
@fields = ("Mr", "Ms", "Mrs", "Dr");
$select = "";
foreach $item (@fields)
{
$selected = "";
$selected = "Selected" if ($item eq $in{'designation'});
$select .= "";
}
$select_designation = $select;
@fields = ("English", "Simplified Chinese", "Traditional Chinese");
$select = "";
foreach $item (@fields)
{
$selected = "";
$selected = "Selected" if ($item eq $in{'preferred_language'});
$select .= "";
}
$select_preferred_language = $select;
@fields = @states;
$select = "";
foreach $item (@fields)
{
$selected = "";
$selected = "Selected" if ($item eq $in{'state'});
$select .= "";
}
$select_state = $select;
@fields = @countries;
$select = "";
foreach $item (@fields)
{
$selected = "";
$selected = "Selected" if ($item eq $in{'country'});
$select .= "";
}
$select_country = $select;
@fields = ("Place of Birth", "Favourite Food", "Mother's Maiden Name");
$select = "";
foreach $item (@fields)
{
$selected = "";
$selected = "Selected" if ($item eq $in{'password_question'});
$select .= "";
}
$select_password_question = $select;
$accept = "Checked" if ($in{'accept'});
$notification = "Checked" if ($in{'notification'} || ! $in{'_verac'});
$javascript = "";
$stout .= "";
$stout .= "";
$stout .= "
Information is required";
$stout .= "";
$stout .= "
$hostsel
| Hosting | $host[ substr($store_id[0], 0, 1) ]
|
| Monthly | S\$ " . decimaling($rates[$cycle]) . "
|
| Setup Fee | S\$ $host_type[ substr($store_id[0], 0, 1) ]
|
| Billing Cycle | $store_id[2] months
|
";
$stout .= " | ";
print "\n";
&include("inwww-head.txt");
print "";
print "$javascript";
&include("inwww-top.txt");
print "
| ";
&include("inwww-order-menu.txt");
print " |
 Hosting Order Form ";
print "$stout";
print " |
 |
";
&include("inwww-bot.txt");
sub retraitement
{
my($str) = @_;
$str =~ s/^[ ]+//;
$str =~ s/[ ]+$//;
$str =~ s/[#~#]+/ /g;
$str =~ s/^[']+/`/;
$str =~ s/[']+$/`/;
$str =~ s/[']+/`/g;
return $str;
}