I have a bit of an issue, I'm getting a redirect loop and I've changed absolutely nothing for it to start. I haven't edited a single line of code to make it stop, and I've done extensive debugging and can't find the issue.
Whenever I put a zip code in that search box, it just gives me an infinite redirect loop.
My site is sparkle wash . com (can't post more than two links in a post, sorry!)
My index.php file: http://pastebin.com/8NuUt6Lu
My search.php http://pastebin.com/cHjhAFwH
I do apologize if it seems like a stupid mistake, but I'm new to PHP and I didn't even write this. I'm just these people's web designer and they expect me to fix what they had someone write for them a year ago.
Edit Here is what my .htaccess looks like http://pastebin.com/4YR6SqMh, I have no idea what it should look like/do.
Replace all the location items with something like this, its easier to read and update:
if(!empty($state = $_GET["state"])){
// Location data add multiple lines
$locations["/placercounty"] = array(
"ranges" => array(
array("from" => 90001, "to" => 96162)
)
"matches" => array(
"california",
"placer-county",
"auburn",
)
);
$locations["/northcentralohio"] = array(
"ranges" => array(
array("from" => 44312, "to" => 44312)
)
"matches" => array(
"akron",
)
);
// No need to touch below this
$state = clean($state);
$theZip = strtolower($state);
$location = false;
foreach($locations as $url => $matchData){
if(isset($matchData["matches"])){
if(in_array($theZip, $matchData["matches"])){
$location = $url;
break;
}
}
if(isset($matchData["ranges"])){
foreach($matchData["ranges"] as $rangeData){
if(isset($rangeData["from"]) && isset($rangeData["to"])){
if($theZip >= $rangeData["from"] && $theZip <= $rangeData["to"]){
$location = $url;
break 2;
}
}
}
}
}
if($location){
header("Location: " . $location);
die();
}
}