#! /usr/bin/perl


$| = 1;

# Print out a content-type for HTTP/1.0 compatibility
print "Content-type:text/html\n\n";

# Print a title and initial heading
print "<HTML>";
print "<Head><Title>Buy Resort Properties Maintain Regions</Title></Head>";
print "<Body BGCOLOR =#FFFFFF>\n";

use DBI;
use Config;
use Cwd;
#use strict;



my $dbh = DBI->connect('DBI:mysql:computercar', 'rclee', '0419') || 
        die ("can't connect to the database: $!");

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

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

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

   # Un-Webify plus signs and %-encoding
   $value =~ tr/+/ /;
   $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
   $value =~ s/<!--(.|\n)*-->//g;

   $value =~ s/<([^>]|\n)*>//g;


   $FORM{$name} = $value;
}

print <<"HTML_STUFF";
<center><img src="/images/header1.gif" border=0 alt=Buy Resort Properties><br> 

<P><center>
<table width=600><tr><td>

To list Properties-  Listing Rates:  One listing- \$39.95 per month. 
Exclusive area general section per year \$360.00 Please go to front page and click on red button to get username and password.  Please follow instructions from there.
<p>
  Featured Section-  Exclusive advertising section that places your listings apart from the General Section listings.  Rate: \$89.95 per month. Go to front page, click on red button for username and password.  Scroll down to Featured Section red button and follow instructions on that page to schedule.
<p>
  Realtors, Buyers Agents, and Exclusive Buyers Agents Directory-  Seen on all front pages and over all listing pages world wide.  Rate: \$150.00 per year Per 2 areas.  Please e-mail the following information: Company name, Location,  Contact name, Phone, e-mail, and URL.
<p>
Pay by Visa or Master Card
<br><img src=http://images.paypal.com/images/x-click-but02.gif><p>

Or<p>
 
 Send check to:<p>
 BRP<br>
 1010 Idaho Ave.<br>
 Natrona Heights, PA 15065 USA.<p>

<p>
  Special Property Section-  Seen over every listing. \$200.00 per month. E-mail now to reserve your area. <a href=mailto:info\@buyresortproperties.com> info\@buyresortproperties.com</a>   
<p>
  Individual Property Ad Between Featured Section and Shopping Mall button on Front Pages-  Rates:  Real Estate Front Page- \$800.00 per month. 
 Rental Front Page-\$600.00 per month.  Timeshare Front Page: \$600.00 per month.  Schedule now.  Only three spots per month.  
<p>
  Banner Ad Section in Shopping Mall: Rate: \$60.00 per region per year.  E-mail for multiple rates.
  Please complete form below and paste banner.



<P>
<P>

<FORM METHOD=POST ACTION="/cgi-bin/insert_company.cgi">

<table>

<tr><td>Company Name</td>
<td><input type=text name=company size=20 maxlength=45></td></tr>

<tr><td>Contact Name</td>
<td><input type=text name=contact_name size=20 maxlength=45></td></tr>

<tr><td>Address</td>
<td><input type=text name=address size=20 maxlength=30></td></tr>

<tr><td>City</td>
<td><input type=text name=city size=20 maxlength=30></td></tr>

<tr><td>State</td>
<td><input type=text name=state size=2 maxlength=2></td></tr>

<tr><td>Zip</td>
<td><input type=text name=zip size=10 maxlength=10></td></tr>

<tr><td>Phone #</td>
<td><input type=text name=phone size=20 maxlength=20></td></tr>

<tr><td>email</td>
<td><input type=text name=email size=30 maxlength=30></td></tr>

<TR><TD>Category:</TD>
<TD>
<SELECT NAME=category>
<OPTION selected value="">Select a Category
<OPTION> Fashion
<OPTION> Art Photo
<OPTION> Banking
<OPTION> DVD
<OPTION> Flowers
<OPTION> Kids/Babies
<OPTION> Web Tools
<OPTION> Toys
<OPTION> Electronics
<OPTION> Financial Services
<OPTION> Gifts & Collectibles
<OPTION> Insurance
<OPTION> Home/Garden
<OPTION> Computers Hardware/Software
<OPTION> Automotive
<OPTION> Books
<OPTION> Office Supplies & Services
<OPTION> Jewelry
<OPTION> Health & Beauty
<OPTION> Real Estate Directory
<OPTION> Department Stores
<OPTION> Auctions
<OPTION> Travel
<OPTION> Food & Wine
</SELECT> 
</TD>
</TR>

HTML_STUFF

print "<TR><TD>Region:</TD>\n";
print "<TD><select NAME=region>\n";
print "<option selected value=\"\">Select a Region\n";

my $cursor_s = $dbh->prepare("select region_id, region
	from region
        where region_id > 0
	order by region ");

$cursor_s->execute or die "can't execute the query";
my $table = $cursor_s->fetchall_arrayref or die "$cursor_s->errstr\n";
my($i, $j);

for $i ( 0 .. $#{$table} ) {

   print "<option value=$table->[$i][0]>$table->[$i][1]\n";
}


print "</select></TD></TR>\n";

print "<TR><TD>Banner:</TD><TD colspan=8><INPUT NAME=url TYPE=text SIZE=80 maxlength=400></TD></TR>\n";
#print "<TR><TD></TD><TD colspan=8>";
#print "(for example  <code><a href=http://www.buyresortproperties.com><img ";
#print "src=http://www.buyresortproperties.com/images/header1.gif></a></code>)</TD></TR>\n";
print "</table><P>\n";



print "<INPUT TYPE=submit VALUE=Submit><INPUT TYPE=reset VALUE=Reset>\n";
print "</FORM>";
print "</td></tr></table>";
print "</BODY></HTML>\n";

my $rc2 = $dbh->disconnect;
