_GET 美元请求的重定向循环


Redirect Loop on $_GET Request

我有一点问题,我得到了一个重定向循环,但我完全没有改变它。我没有编辑任何一行代码来使其停止,并且我已经进行了广泛的调试,但找不到问题。

每当我在搜索框中输入邮政编码时,它都会给我一个无限的重定向循环。

我的网站是闪闪发光的洗涤.com(不能在帖子中发布两个以上的链接,对不起!

我的索引.php文件:http://pastebin.com/8NuUt6Lu

我的搜索.php http://pastebin.com/cHjhAFwH

如果这看起来像是一个愚蠢的错误,我深表歉意,但我是PHP的新手,我什至没有写这个。我只是这些人的网页设计师,他们希望我修复他们一年前有人为他们写的东西。

编辑这是我的.htaccess看起来像 http://pastebin.com/4YR6SqMh,我不知道它应该是什么样子/做什么。

将所有

位置项替换为以下内容,它更易于阅读和更新:

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();
    }
}