#!/usr/bin/perl
# INSTAbase Order Form

require "cgi-lib.pl";

$time = localtime();
@tt = split(/ /,$time);
@pp = split(/:/,$tt[3]);

 
###&ReadParse(*cgi);
&parse_form;

$results = &PrintVariables(%cgi);
sub parse_form {

   # Get the input
   read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

   # Split the name-value pairs
   @pairs = split(/&/, $buffer);

   foreach $pair (@pairs) {
      ($name, $value) = split(/=/, $pair);

      $value =~ tr/+/ /;
      $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

      $cgi{$name} = $value;
   }
}
# load in the form contents

($product = $cgi{'product'}) =~ s/\n/ /g;
($payment = $cgi{'payment'}) =~ s/\n/ /g;
($country = $cgi{'country'}) =~ s/\n/ /g;


if($cgi{'payment'}=~/creditcard/){
	&creditcard;

}elsif($cgi{'payment'}=~/cheque/){
	&cheque;

}elsif($cgi{'payment'}=~/Phone/){
	
printf("%s", &PrintHeader);
printf("<BODY background=\"/images/instabase/orderback.gif\"> \n");
print "<center>";
print "<table bgcolor=\"#FFFDDF\" width=100% border=2 cellpadding=5><tr valign=top>";
		print "<td><font face=arial size=2><center>";
		print "<img src=\"/images/instabase/regsoft1.gif\"><br>";
		print "Secure Phone Transaction Service Provided by Regsoft.com<p>";
	
		print "<center><img src=\"/images/instabase/visa.gif\"> <img src=\"/images/instabase/mastercard.gif\"> <img src=\"/images/instabase/amex.gif\"></center><p>";


print "Thank you.<br><font color=red>To place your order by phone please call:<br>";
print "1-888-734-4880 and provide the product ID.</font><br>";

	if($cgi{'country'}=~/canada/){
		print "<i><b>Canadian customers please note that all transactions are in US dollars automatically converted to Canadian dollars once approved.</b></i><br>";
	}

print "<table width=100%>";

print "<tr><td bgcolor=lightblue><font face=arial size=2><font color=#22c033><b>Electronic version</b></font><br>";
print "<b>INSTAbase 5.0 Standard (Product ID 34535) - <font color=\"#000000\">US\$59.00</font></b><br>";
print "<b>INSTAbase 5.0 Upgrade (Product ID 34535) - <font color=\"#000000\">US\$149.00</font></b><br>";

print "<tr><td bgcolor=lightgrey>";
print "</tr></td></table>";
print "If you haven't downloaded INSTAbase yet, please make sure you do so by clicking on the link to the left, labeled <b>Download</b>";

}


#========================= output to screen for Cheque ========================

sub cheque {

     $errstr = shift @_;

printf("%s", &PrintHeader);
printf("<BODY background=\"/images/instabase/orderback.gif\"> \n");

print "<center>";

#--------------------------------- 4.0 standard full -------------------------

if($cgi{'product'}=~/1/){
	if($cgi{'country'}=~/us/){
		print "<h2>Thank you.<br><font color=red>Please send a cheque for \$39.95</font> in US Funds to: </h2>";
	}if($cgi{'country'}=~/canada/){
		print "<h2>Thank you.<br><font color=red>Please send a cheque for \$62.06 (\$66.70 if in Ontario)</font><br>in Canadian Funds to: </h2>";
	}
}
#--------------------------------- 4.0 web ready full -------------------------

if($cgi{'product'}=~/2/){
	if($cgi{'country'}=~/us/){
	   if($cgi{'media'}=~/electronic/){
		print "<h2>Thank you.<br><font color=red>Please send a cheque for \$59.95</font> in US Funds to: </h2>";
	   }
	   if($cgi{'media'}=~/cd/){
		print "<h2>Thank you.<br><font color=red>Please send a cheque for \$69.95</font> in US Funds to: </h2>";
	   }

	}
	if($cgi{'country'}=~/canada/){
	   if($cgi{'media'}=~/electronic/){
		print "<h2>Thank you.<br><font color=red>Please send a cheque for \$94.16 (\$101.20 if in Ontario)</font><br>in Canadian Funds to: </h2>";
	   }
	   if($cgi{'media'}=~/cd/){
		print "<h2>Thank you.<br><font color=red>Please send a cheque for \$114.49 (\$123.05 if in Ontario)</font><br>in Canadian Funds to: </h2>";
	   }
	}
}

#--------------------------------- 4.0 standard upgrade -------------------------

if($cgi{'product'}=~/3/){
	if($cgi{'country'}=~/us/){
		print "<h2>Thank you.<br><font color=red>Please send a cheque for \$9.95</font> in US Funds to: </h2>";
	}
	if($cgi{'country'}=~/canada/){
		print "<h2>Thank you.<br><font color=red>Please send a cheque for \$15.52 (\$16.68 if in Ontario)</font><br>in Canadian Funds to: </h2>";
	}
}

#--------------------------------- 4.0 web ready upgrade -------------------------

if($cgi{'product'}=~/4/){
	if($cgi{'country'}=~/us/){
		print "<h2>Thank you.<br><font color=red>Please send a cheque for \$29.95</font> in US Funds to: </h2>";
	}
	if($cgi{'country'}=~/canada/){
		print "<h2>Thank you.<br><font color=red>Please send a cheque for \$46.55 (\$50.03 if in Ontario)</font><br>in Canadian Funds to: </h2></font>";
	}
}



print "<table bgcolor=\"#fffddf\" border=1><tr><td><ul><b>";
print "Ezenet Inc.<br>";
print "940-90 Eglinton Ave. East<br>";
print "Toronto, ON   M4P 2Y3<br>";
print "Canada</b></ul><p>";
print "Please include with your cheque a letter with:<ul>";
print "<li>Your name<br>";
print "<li>Your full mailing address<br>";
print "<li>Your Email and Telephone<br>";
print "<li>The Security Code that INSTAbase displays on startup.</ul>";
print "</td></tr></table>";
print "<p>If you haven't downloaded INSTAbase yet, please make sure you do so by clicking on the link to the left, labeled <b>Download</b>";
        exit;
}


#========================= output to screen for credit card ========================

sub creditcard {

     $errstr = shift @_;

printf("%s", &PrintHeader);
printf("<BODY background=\"/images/instabase/orderback.gif\"> \n");

print "<center>";


#--------------------------------- 4.0 standard full -------------------------

if($cgi{'product'}=~/1/){
	if($cgi{'country'}=~/us/){
		print "<table bgcolor=\"#FFFDDF\" width=200 border=2 cellpadding=5><tr valign=top>";
		print "<td><font face=arial size=2><center>";
		print "<img src=\"/images/instabase/regsoft1.gif\"><br>";
		print "Secure Online Transaction Service Provided by Regsoft.com<p>";
		print "<b>INSTAbase 4.0 Standard - <font color=\"#FF0000\">US\$39.95</font></b><br>";
		print "<center><img src=\"/images/instabase/visa.gif\"> <img src=\"/images/instabase/mastercard.gif\"> <img src=\"/images/instabase/amex.gif\"></center><p>";
		print "<a href=\"https://www.regsoft.com/cgi-bin/reg_it_offsite.pl?4333\"><img src=\"/images/instabase/regsoft_button1.gif\" border=0></a>";
		print "<p>If you haven't downloaded INSTAbase yet, please make sure you do so by clicking on the link to the left, labeled <b>Download</b></font></td></tr></table>";


	}if($cgi{'country'}=~/canada/){
		print "<table bgcolor=\"#FFFDDF\" width=200 border=2 cellpadding=5><tr valign=top>";
		print "<td><font face=arial size=2><center>";
		print "<img src=\"/images/instabase/ismerch2.gif\"><br>";
		print "Secure Online Transaction Service Provided by Internet Secure<p>";
		print "<b>INSTAbase 4.0 Standard<br><font color=\"#FF0000\">CDN\$62.06 (\$66.70 if in Ontario)</font></b><br>";
		print "Including Applicable Taxes<br>";
		print "<FORM METHOD=POST ACTION=https://secure.internetsecure.com/process.cgi>";
		print "<INPUT TYPE=HIDDEN NAME=language VALUE=english>";
		print "<INPUT TYPE=HIDDEN NAME=MerchantNumber VALUE=205>";
		print "<INPUT TYPE=HIDDEN NAME=ReturnURL VALUE=http://www.instabase.com>";
		print "<INPUT TYPE=HIDDEN NAME=Products VALUE=6,1>";
		print "<INPUT TYPE=SUBMIT VALUE=\"Buy it now!\">";
		print "</FORM>";
		print "<center><img src=\"/images/instabase/visa.gif\"> <img src=\"/images/instabase/mastercard.gif\"></center><p>";
		print "<p>If you haven't downloaded INSTAbase yet, please make sure you do so by clicking on the link to the left, labeled <b>Download</b></font></td></tr></table>";

	}
}
#--------------------------------- 5.0 web ready full -------------------------

if($cgi{'product'}=~/2/){
	if($cgi{'country'}=~/us/){
				
	   if($cgi{'media'}=~/electronic/){
		print "<table bgcolor=\"#FFFDDF\" width=200 border=2 cellpadding=5><tr valign=top>";
		print "<td><font face=arial size=2><center>";
		print "<img src=\"/images/instabase/regsoft1.gif\"><br>";
		print "Secure Online Transaction Service Provided by Regsoft.com<p>";
		print "<b>INSTAbase 5.0 Web Ready Full Version - <font color=\"#FF0000\">US\$149.00</font></b><br>";
		print "<center><img src=\"/images/instabase/visa.gif\"> <img src=\"/images/instabase/mastercard.gif\"> <img src=\"/images/instabase/amex.gif\"></center><p>";
		print "<a href=\"http://www.regsoft.net/purchase.php3?productid=34535&pc=g2A59\"><img src=\"/images/instabase/regsoft_button1.gif\" border=0></a>";
		print "<p>If you haven't downloaded INSTAbase yet, please make sure you do so by clicking on the link to the left, labeled <b>Download</b></font></td></tr></table>";
	   }

	   if($cgi{'media'}=~/cd/){
		print "<table bgcolor=\"#FFFDDF\" width=200 border=2 cellpadding=5><tr valign=top>";
		print "<td><font face=arial size=2><center>";
		print "<img src=\"/images/instabase/regsoft1.gif\"><br>";
		print "Secure Online Transaction Service Provided by Regsoft.com<p>";
		print "<b>INSTAbase 5.0 Web Ready Upgrade Version - <font color=\"#FF0000\">US\$59.00</font></b><br>";
		print "<center><img src=\"/images/instabase/visa.gif\"> <img src=\"/images/instabase/mastercard.gif\"> <img src=\"/images/instabase/amex.gif\"></center><p>";
		print "<a href=\"http://www.regsoft.net/purchase.php3?productid=34535&pc=H492I\"><img src=\"/images/instabase/regsoft_button1.gif\" border=0></a>";
		print "</font></td></tr></table>";
	   }

	}
	if($cgi{'country'}=~/canada/){

   	   if($cgi{'media'}=~/electronic/){
		print "<table bgcolor=\"#FFFDDF\" width=200 border=2 cellpadding=5><tr valign=top>";
		print "<td><font face=arial size=2><center>";
		print "<img src=\"/images/instabase/ismerch2.gif\"><br>";
		print "Secure Online Transaction Service Provided by Internet Secure<p>";
		print "<b>INSTAbase 4.0 Web Ready - Electronic Version<br><font color=\"#FF0000\">CDN\$94.16 (\$101.20 if in Ontario)</font></b><br>";
		print "Including Applicable Taxes<br>";
		print "<FORM METHOD=POST ACTION=https://secure.internetsecure.com/process.cgi>";
		print "<INPUT TYPE=HIDDEN NAME=language VALUE=english>";
		print "<INPUT TYPE=HIDDEN NAME=MerchantNumber VALUE=205>";
		print "<INPUT TYPE=HIDDEN NAME=ReturnURL VALUE=http://www.instabase.com>";
		print "<INPUT TYPE=HIDDEN NAME=Products VALUE=7,1>";
		print "<INPUT TYPE=SUBMIT VALUE=\"Buy it now!\">";
		print "</FORM>";
		print "<center><img src=\"/images/instabase/visa.gif\"> <img src=\"/images/instabase/mastercard.gif\"></center><p>";
		print "<p>If you haven't downloaded INSTAbase yet, please make sure you do so by clicking on the link to the left, labeled <b>Download</b></font></td></tr></table>";
	   }

   	   if($cgi{'media'}=~/cd/){
		print "<table bgcolor=\"#FFFDDF\" width=200 border=2 cellpadding=5><tr valign=top>";
		print "<td><font face=arial size=2><center>";
		print "<img src=\"/images/instabase/ismerch2.gif\"><br>";
		print "Secure Online Transaction Service Provided by Internet Secure<p>";
		print "<b>INSTAbase 4.0 Web Ready - CD-ROM Version<br><font color=\"#FF0000\">CDN\$114.49 (\$123.05 if in Ontario)</font></b><br>";
		print "Including Applicable Taxes<br>";
		print "<FORM METHOD=POST ACTION=https://secure.internetsecure.com/process.cgi>";
		print "<INPUT TYPE=HIDDEN NAME=language VALUE=english>";
		print "<INPUT TYPE=HIDDEN NAME=MerchantNumber VALUE=205>";
		print "<INPUT TYPE=HIDDEN NAME=ReturnURL VALUE=http://www.instabase.com>";
		print "<INPUT TYPE=HIDDEN NAME=Products VALUE=8,1>";
		print "<INPUT TYPE=SUBMIT VALUE=\"Buy it now!\">";
		print "</FORM>";
		print "<center><img src=\"/images/instabase/visa.gif\"> <img src=\"/images/instabase/mastercard.gif\"></center><p>";
		print "</font></td></tr></table>";
	   }
	}
}

#--------------------------------- 4.0 standard upgrade -------------------------

if($cgi{'product'}=~/3/){
	if($cgi{'country'}=~/us/){
		print "<h2>Thank you.<br>Upgrade payments can only be made with a cheque<br><font color=red>Please send a cheque for \$9.95</font> in US Funds to: </h2>";
		print "<table bgcolor=\"#fffddf\" border=1><tr><td><ul><b>";
		print "Ezenet Inc.<br>";
		print "940-90 Eglinton Ave. East<br>";
		print "Toronto, ON   M4P 2Y3<br>";
		print "Canada</b></ul><p>";
		print "Please include with your cheque a letter with:<ul>";
		print "<li>Your name<br>";
		print "<li>Your full mailing address<br>";
		print "<li>Your Email and Telephone<br>";
		print "<li>The Security Code that INSTAbase displays on startup.</ul>";
		print "<p>If you haven't downloaded INSTAbase yet, please make sure you do so by clicking on the link to the left, labeled <b>Download</b></font></td></tr></table>";

	}
	if($cgi{'country'}=~/canada/){
		print "<h2>Thank you.<br>Upgrade payments can only be made with a cheque<br><font color=red>Please send a cheque for \$15.52 (\$16.68 if in Ontario)</font><br>in Canadian Funds to: </h2>";
		print "<table bgcolor=\"#fffddf\" border=1><tr><td><ul><b>";
		print "Ezenet Inc.<br>";
		print "940-90 Eglinton Ave. East<br>";
		print "Toronto, ON   M4P 2Y3<br>";
		print "Canada</b></ul><p>";
		print "Please include with your cheque a letter with:<ul>";
		print "<li>Your name<br>";
		print "<li>Your full mailing address<br>";
		print "<li>Your Email and Telephone<br>";
		print "<li>The Security Code that INSTAbase displays on startup.</ul>";
		print "<p>If you haven't downloaded INSTAbase yet, please make sure you do so by clicking on the link to the left, labeled <b>Download</b></font></td></tr></table>";

	}
}

#--------------------------------- 4.0 web ready upgrade -------------------------

if($cgi{'product'}=~/4/){
	if($cgi{'country'}=~/us/){
		print "<h2>Thank you.<br>Upgrade payments can only be made with a cheque<br><font color=red>Please send a cheque for \$29.95</font> in US Funds to: </h2>";
		print "<table bgcolor=\"#fffddf\" border=1><tr><td><ul><b>";
		print "Ezenet Inc.<br>";
		print "940-90 Eglinton Ave. East<br>";
		print "Toronto, ON   M4P 2Y3<br>";
		print "Canada</b></ul><p>";
		print "Please include with your cheque a letter with:<ul>";
		print "<li>Your name<br>";
		print "<li>Your full mailing address<br>";
		print "<li>Your Email and Telephone<br>";
		print "<li>The Security Code that INSTAbase displays on startup.</ul>";
		print "<p>If you haven't downloaded INSTAbase yet, please make sure you do so by clicking on the link to the left, labeled <b>Download</b></font></td></tr></table>";

	}
	if($cgi{'country'}=~/canada/){
		print "<h2>Thank you.<br>Upgrade payments can only be made with a cheque<br><font color=red>Please send a cheque for \$46.55 (\$50.03 if in Ontario)</font><br>in Canadian Funds to: </h2></font>";
		print "<table bgcolor=\"#fffddf\" border=1><tr><td><ul><b>";
		print "Ezenet Inc.<br>";
		print "940-90 Eglinton Ave. East<br>";
		print "Toronto, ON   M4P 2Y3<br>";
		print "Canada</b></ul><p>";
		print "Please include with your cheque a letter with:<ul>";
		print "<li>Your name<br>";
		print "<li>Your full mailing address<br>";
		print "<li>Your Email and Telephone<br>";
		print "<li>The Security Code that INSTAbase displays on startup.</ul>";
		print "<p>If you haven't downloaded INSTAbase yet, please make sure you do so by clicking on the link to the left, labeled <b>Download</b></font></td></tr></table>";

	}
}




        exit;
}



