header('Content-type: text/html'); header("Cache-Control: no-cache, must-revalidate"); header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past header('X-Content-Type-Options: nosniff'); ?> include_once("/mnt/cluster/www6/readysetgov/includes/common.php"); include_once('include/config.php'); include_once('include/lib.php'); $dbh = db_connect(); if ($_REQUEST["County"] != "") { $Submit1 = true; } else if ($_REQUEST["City"] != "") { $Submit2 = true; } else if ($_REQUEST["Zip"] != "") { $Submit3 = true; } if ($Submit1 && $_REQUEST["County"] != "") { $sqlCounty = "SELECT SQL_CACHE * from counties where county_id ='" . mysql_real_escape_string($_REQUEST['County'])."' and county_active != 0"; $resultCounty = @mysql_query( $sqlCounty ) or die(); $rowCounty = mysql_fetch_assoc($resultCounty); header("Location: county.php?c=$rowCounty[county_folder]"); } elseif ($Submit2 && $_REQUEST["City"] != "") { $City = rtrim($_REQUEST["City"]); $sqlTown = "SELECT SQL_CACHE * from towns, counties where town_name like '%". mysql_real_escape_string($City) ."%' and town_active != 0 and county_id = town_county_id order by town_name"; $resultTown = @mysql_query( $sqlTown ) or die(mysql_error()); $townArray = ""; while ($rowTown = mysql_fetch_assoc($resultTown)) { $townArray[$rowTown["town_name"]] = "town.php?t=$rowTown[town_name]"; } if (count($townArray) == 1 && $townArray != "") { foreach($townArray as $k => $v) header("Location: $v"); } if ($townArray == "") { $error = "Sorry, there were no results found for City/Town Search of: " . htmlentities(urlencode($City)) . ""; } } elseif ($Submit3 && $_REQUEST["Zip"] != "") { $Zip = rtrim($_REQUEST["Zip"]); $sqlTown = "SELECT SQL_CACHE * from counties,towns,zip where zip = '". mysql_real_escape_string($Zip) ."' and town_active != 0 and town_name = city and county_id = town_county_id"; $resultTown = @mysql_query( $sqlTown ) or die(); $townArray = ""; $City = $_REQUEST["Zip"]; while($rowTown = mysql_fetch_assoc($resultTown)) { $townArray[$rowTown["town_name"]] = "town.php?t=$rowTown[town_name]"; } if (count($townArray) == 1 && $townArray != "") { foreach($townArray as $k => $v) $values = explode("/", $v); header("Location: " . $values[0]); } if ($townArray == "") { $error = "Sorry, there were no results found for Zipcode: " . htmlentities(urlencode($Zip)) . ""; } } else { $error = "Please enter search criteria."; } if ($_REQUEST["show_towns"]) { $error = false; } $sqlCounty= "SELECT SQL_CACHE * from counties where county_active = 1 order by RAND()"; $resultCounty = @mysql_query( $sqlCounty ) or die(mysql_error()); $rowCounty = mysql_fetch_assoc($resultCounty); $showImage = "-$rowCounty[county_folder]"; if ($_REQUEST["Zip"]) { $h1 = "City & Town Index"; } else { $h1 = "Search Results"; } ?>