#!/usr/bin/perl
###############################################################################
#
#
# 3/24/2008 - Created for gotacres.com to feed available properties page.
#
#
use CGI;
use CGI::Carp qw/fatalsToBrowser/;
$cgi = new CGI;
use DBI;
$Keywords=$ENV{REQUEST_URI};
require "../got_data/gotacresql.pl";
&SQLVAR;
$dbh = DBI->connect("DBI:mysql:database=$db_name;host=$db_host", $db_user, $db_pass, {'RaiseError' => 1});
$sth = $dbh->prepare("SELECT * FROM geodesic_auctions WHERE live='1' AND description NOT LIKE \"%OK%\" ORDER BY current_bid DESC");
$sth->execute();
$ref = $sth->fetchrow_hashref;
$Mikes = $ref->{'description'};
$Mike_hash_in = $Mikes;
&GETMIKEHASH;
$Mikes = $Mike_hash_in;
#$Mikes =~ s/\
//gi;
$Auction_number = $ref->{'id'};
$sth1 = $dbh->prepare("SELECT * FROM geodesic_auctions_images_urls WHERE auction_id='$Auction_number' ORDER BY image_id");
$sth1->execute();
$ref1 = $sth1->fetchrow_hashref;
$Mike_hash_in = $ref->{'title'};
&GETMIKEHASH;
$Auction_title = $Mike_hash_in;
print "Content-type: text/html\n\n";
open (TOPT, "templatetop");
until (eof (TOPT)){
$Topt = ;
chop $Topt;
print "$Topt\n";
}
&GETDATEINFO;
print "Available as of $Date1!
";
$sth1 = $dbh->prepare("SELECT * FROM geodesic_auctions_images_urls WHERE auction_id='$Auction_number' ORDER BY full_filename ASC");
$sth1->execute();
$ref1 = $sth1->fetchrow_hashref;
print "Many more properties at web site. Click here to view all auctions or on the picture below to view this one.
";
if ($ref1->{'thumb_file'} ne "" && $ref1->{'thumb_file'} =~ /\.jpg/i){
$use_image = $ref1->{'thumb_filename'};
}
else {
$use_image = $ref1->{'full_filename'};
}
$piccnt++;
print " | \n";
print "$Auction_title | ";
#$printstring = substr ($Mikes, 0,200);
#$Mike_hash_in = $Mikes;
#&GETMIKEHASH;
#$Mikes = $Mike_hash_in;
@mike = split (/\<\/P\>/ , $Mikes);
$printstring = $mike[0];
$printstring = substr ($mike[0], 0,100);
$New_print_string = "";
$printed1=0;
$One_link_this = "";
$Mike_hash_in = $mike[0];
&GETMIKEHASH;
$Mike_hash_in =~ s/buyer%27s/buyer\'s/g;
print "$Mike_hash_in | ";
$bidcount=0;
$sth1 = $dbh->prepare("SELECT * FROM geodesic_auctions_bids WHERE auction_id='$Auction_number'");
$sth1->execute();
while ($ref1 = $sth1->fetchrow_hashref){
$bidcount++;
}
print "$bidcount bid(s) | \n";
print "
|
|
\n";
open (WEST, "../got_data/westernusaland.txt");
until (eof (WEST)){
$West = ;
chop $West;
print "$West\n";
}
close WEST;
print " |
\n";
open (OKLA, "../got_data/oklandrush.txt");
until (eof (OKLA)){
$Okla = ;
chop $Okla;
print "$Okla\n";
}
close OKLA;
print "
\n";
#print "5/15/2008: Available properties coming soon!
\n";
open (BOTT, "templatebottom");
until (eof (BOTT)){
$Bott = ;
chop $Bott;
print "$Bott\n";
}
################################################################################################################################################################################
sub GETDATEINFO {
@months = ("January","February","March","April","May","June","July","August","September","October","November","December");
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year += 1900;
$year1 = substr ($year, 2,2);
if ($sec < 10) {
$sec = "0$sec";
}
if ($min < 10) {
$min = "0$min";
}
if ($hour < 10) {
$hour = "0$hour";
}
$mhour = $hour;
if ($mon < 10) {
$mon = "0$mon";
}
if ($mday < 10) {
$mday = "0$mday";
}
$month = ($mon + 1);
if ($month eq "01" || $month eq "1"){
$month1="JAN";
}
if ($month eq "2"){
$month1="FEB";
}
if ($month eq "3"){
$month1="MAR";
}
if ($month eq "4"){
$month1="APR";
}
if ($month eq "5"){
$month1="MAY";
}
if ($month eq "6"){
$month1="JUN";
}
if ($month eq "7"){
$month1="JUL";
}
if ($month eq "8"){
$month1="AUG";
}
if ($month eq "9"){
$month1="SEP";
}
if ($month eq "10"){
$month1="OCT";
}
if ($month eq "11"){
$month1="NOV";
}
if ($month eq "12"){
$month1="DEC";
}
$hours1 = "$hour";
$Date1 = "$month/$mday/$year";
$sqldate1 = "$year"."\-"."$month"."\-"."$mday";
}
#############################################################################################################################################################################
sub GETMIKEHASH {
$Mike_hash_in =~ s/\+/ /g;
$Mike_hash_in =~ s/\%21/\!/g;
$Mike_hash_in =~ s/\%24/\$/g;
$Mike_hash_in =~ s/\%3C/\/g;
$Mike_hash_in =~ s/\%3A/\:/g;
$Mike_hash_in =~ s/\%2C/\,/g;
$Mike_hash_in =~ s/\%2F/\//g;
$Mike_hash_in =~ s/\%0A/ /g;
$Mike_hash_in =~ s/\%0D//g;
$Mike_hash_in =~ s/\%28/\(/g;
$Mike_hash_in =~ s/\%29/\)/g;
$Mike_hash_in =~ s/\%92/\'/g;
$Mike_hash_in =~ s/\%25/\%/g;
$Mike_hash_in =~ s/\%3F/\?/g;
$Mike_hash_in =~ s/\%23/\#/g;
$Mike_hash_in =~ s/\%3B/\;/g;
$Mike_hash_in =~ s/%27/\'/g;
$Mike_hash_in =~ s/buyer%27s/buyer\'s/g;
$Mike_hash_in =~ s/\%93/\"/g;
$Mike_hash_in =~ s/\%94/\"/g;
$Mike_hash_in =~ s/\%BD/\½/g;
$Mike_hash_in =~ s/\%BC/\¼/g;
$Mike_hash_in =~ s/\%BE/\¾/g;
}
#############################################################################################################################################################################