#!/usr/bin/perl # Custom search of database. require "admin/cgi-lib.cgi"; $|=1; # This should match the mail program on your system. $mailprog = '/usr/lib/sendmail'; # This should be set to the username or alias that runs your # WWW server. # These should be set to the proper constants $siteowner= "Paul Inniss"; $siteowneremail = "paul\@islandtreasure.com"; #The site owner email $phonenumber = "246\-419\-0189"; #The site owner phone number $websitename = "Bajan Treasure"; $websitecompany = "Bajan Treasure"; #The name of the business $websiteurl = "http://www.islandtreasure.com/"; #The URL of the site $websitedomain = "islandtreasure.com"; $webdesign = "SUNNY OASIS"; #The designer of the pages $webdesignurl = "http://www.sunnyoasis.com/"; #The URL of the designer $webdesignemail = "sitedesign\&\#64islandtreasure.com"; #The site designer email $webmaster = "webmaster\@islandtreasure.com"; #The webmaster email # Listings of region names database $regionlist = "regionlist.db"; # Listings of category names database #$categorylist = "Pauls' HD:Home Page:Oasis:Oasis web design:Shoppers World Inc.:usbride:categorylist.db"; #$directory = "/www44/web/isla12"; $directory = $ENV{'DOCUMENT_ROOT'}; $categorylist = "$directory" . "/admin/categorylist.db"; MAIN: { # Read in all the variables set by the form &ReadParse(*input); # Print the header print &PrintHeader; #=============================================================================== # Main database listing is next file #$FileName = "Pauls' HD:Home Page:Oasis:Oasis web design:Shoppers World Inc.:usbride:variablema.db"; $FileName = "$directory" . "/admin/variable.db"; $stateabbrev = "$input{'stateabbrev'}"; #=============================================================================== # Set up javascript back and forward buttons $back = "
"; $forward = ">\" onCLick=\"history.forward()\" OnMouseOver=\"message(\'Click this to go forward to a frame that is ahead of this one\'); return true\">"; if ("$input{'explorer'}" eq "yes") { $back = ""; $forward = ""; } #------------------------------------------------------------------------------ # Make array of categories open (CATEGORY, "<$categorylist") || die "Can't open $categorylist, press and hold down the mouse button to return to the previous screen
"; while () { chop; # Make array for each category @categoryarray = split(",", $_); if ("$categoryarray[0]" eq "$input{'category'}") { last; } } close CATEGORY; #------------------------------------------------------------------------------ # Print top of page stuff $toppage = "listingstop.html"; $toppagespecial = "$categoryarray[5]" . "top\.html"; open (TOPPAGE, "<$toppage"); while () { s/"/\\"/g; print eval qq/"$_"/; } if (-e $toppagespecial) { open (TOPPAGESPECIAL, "<$toppagespecial"); while () { s/"/\\"/g; print eval qq/"$_"/; } } print "
    "; # First list listings with coupons or home pages &dbsearch; $nolinks = 1; # Next list all clients in category alphabetically #&dbsearch; #=============================================================================== # Print bottom of page stuff print <
ENDOFLAST if ($somefound != 1) { print "

Sorry, there were no listings in that category.
Please return to the category page to choose a different category.

"; } print <



ENDOFBOTTOM exit(0); } #=============================================================================== sub dbsearch { # Search for matching clients in database and print out each one # Make associative array for each client in database $FileName $regionsomefound = 0; # This tests to see if any entries were found for this region during ALL region searches open (ALLCLIENTS, "<$FileName") || die print "Sorry, the database $FileName is presently being updated and will be available shortly. Please try again in a few minutes. Thanks You.
"; while () { chop; %clientarray = split(/,/, $_); if (("$clientarray{'disabled'}" ne "yes") && ("$clientarray{$input{'category'}}" eq "yes")) { # Increment searchfound variable if a match is found $lastlisting = $.; $sbannergif = ""; $searchfound ++; } if ($searchfound > 0) { $somefound = 1; # Set this to 1 if at least 1 client was found that matches search parameters $regionsomefound = 1; # Set this to 1 if at least 1 client was found in this region that matches search parameters $tempclientbname = "$clientarray{'bname'}"; $tempclientbname =~ s/\047/\040/g; # Replace apostrophes (\047) with a SPACE (\040) $tempclientbname =~ s/\042/\040/g; # Replace double quotes (\042) with a SPACE (\040) # Turn on smallbanner ad if client has one if ("$clientarray{'sbannerad'}" eq "yes") { if (("$clientarray{'homepage'}" ne "enable") && ("$clientarray{'homepage'}" ne "internal") && ("$clientarray{'homepage'}" ne "external")) { $linkpage = "coupon" . ".shtml"; } else { $linkpage = "index" . ".html"; } $sbannertemp = "$clientarray{'clientnumber'}" . "sbanner\.gif"; $sbannergif = ""; } # Print this client listing back to the browser # For vendors with a coupon page to list at beginning of list if (((("$clientarray{'coupon'}" eq "yes") && (("$clientarray{'homepage'}" ne "enable") && ("$clientarray{'homepage'}" ne "internal") && ("$clientarray{'homepage'}" ne "external") && ("$clientarray{'homepage'}" ne "customlink"))) || ("$clientarray{'coupon'}" eq "yes")) && ($nolinks != 1) && ("$clientarray{'disabled'}" ne "yes")) { print "
  • $sbannergif $clientarray{'bname'}
  • "; } # For vendors with a home page to list at beginning of list if ((("$clientarray{'homepage'}" eq "enable") || ("$clientarray{'homepage'}" eq "internal") || ("$clientarray{'homepage'}" eq "external") || ("$clientarray{'homepage'}" eq "customlink")) && ($nolinks != 1) && ("$clientarray{'disabled'}" ne "yes")) { print "
  • $sbannergif$clientarray{'bname'}
  • "; } # For listing clients that have external home pages if (("$clientarray{'externalurl'}" ne "") && (("$clientarray{'homepage'}" ne "enable") && ("$clientarray{'homepage'}" ne "internal") && ("$clientarray{'homepage'}" ne "external") && ("$clientarray{'homepage'}" ne "customlink")) && ($nolinks != 1) && ("$clientarray{'disabled'}" ne "yes")) { print "
  • $clientarray{'bname'}
  • "; } ## For listing clients alphabetically that just have coupons #if (("$clientarray{'externalurl'}" ne "") && (("$clientarray{'homepage'}" ne "enable") && ("$clientarray{'homepage'}" ne "internal") && ("$clientarray{'homepage'}" ne "external") && ("$clientarray{'homepage'}" ne "customlink")) && ($nolinks != 1) && ("$clientarray{'disabled'}" ne "yes")) { # print "
  • $clientarray{'bname'}
  • "; #} # For vendors with no home page or coupon or disabled home or coupon pages. if (($nolinks == 1) && (("$clientarray{'disabled'}" ne "yes") && ("$clientarray{'coupon'}" ne "yes") && (("$clientarray{'homepage'}" ne "enable") && ("$clientarray{'homepage'}" ne "internal") && ("$clientarray{'homepage'}" ne "external") && ("$clientarray{'homepage'}" ne "customlink")))) { print "
  • $clientarray{'bname'}
  • "; } # For listing clients alphabetically that have home pages if (($nolinks == 1) && ("$clientarray{'disabled'}" ne "yes") && (("$clientarray{'homepage'}" eq "enable") || ("$clientarray{'homepage'}" eq "internal") || ("$clientarray{'homepage'}" eq "external") || ("$clientarray{'homepage'}" eq "customlink"))) { print "
  • $clientarray{'bname'}"; } # For listing clients alphabetically that have coupon pages if (($nolinks == 1) && ("$clientarray{'disabled'}" ne "yes") && ("$clientarray{'coupon'}" eq "yes") && (("$clientarray{'homepage'}" ne "enable") && ("$clientarray{'homepage'}" ne "internal") && ("$clientarray{'homepage'}" ne "external") && ("$clientarray{'homepage'}" ne "customlink"))) { print "
  • $clientarray{'bname'}
  • "; } } $searchfound = 0; # Reset the searchfound counter to 0 } close ALLCLIENTS; }