0

Есть вот такой PHP который, приводит к ошибке На этой странице обнаружена циклическая переадресация. Как можно исправить эту ошибку?

if(isset($_GET['aid']) && !is_numeric($_GET['aid'])) die('Hacking Attemp');
include ("GameEngine/Village.php");
include ("GameEngine/Chat.php");
$start = $generator->pageLoadTimeStart();
$alliance->procAlliance($_GET);
if(isset($_GET['newdid'])) {
    $_SESSION['wid'] = $_GET['newdid'];
    if(isset($_GET['s'])){
        header("Location: ".$_SERVER['PHP_SELF']."?s=".preg_replace("/[^a-zA-Z0-9_-]/","",$_GET['s']));
    } else if(isset($_GET['aid'])){
        header("Location: ".$_SERVER['PHP_SELF']."?aid=".preg_replace("/[^a-zA-Z0-9_-]/","",$_GET['aid']));
    } else{
        header("Location: ".$_SERVER['PHP_SELF']);
    }
}

if(isset($_GET['s'])){
    $automation->isWinner();
}

if(isset($_GET['fid'])){
    $fid = preg_replace("/[^0-9]/","",$_GET['fid']);
    $query = "SELECT * FROM " . TB_PREFIX . "forum_cat WHERE id = ".$fid.""; //ппц
    $forum = mysqli_query($database->connection, $query); //?
    $forum_type = mysqli_fetch_array($forum);
    if($forum_type['forum_name'] != "" && $forum_type['forum_area'] == 0){
        if($forum_type['alliance'] != $session->alliance){
            header("Location: ".$_SERVER['PHP_SELF']);
        }
    }
} else if(isset($_GET['fid2'])){
    $fid = preg_replace("/[^0-9]/","",$_GET['fid2']);
    $q = "SELECT * FROM " . TB_PREFIX . "forum_cat WHERE id = ".$fid.""; //ппц
    $forum = mysqli_query($database->connection, $q); //?
    $forum_type = mysqli_fetch_array($forum);
    if($forum_type['forum_name'] != "" && $forum_type['forum_area'] != 1){
        if($forum_type['forum_area'] == 0){
            if($forum_type['alliance'] != $session->alliance){
                header("Location: ".$_SERVER['PHP_SELF']);
            }
        } else if($forum_type['forum_area'] == 2){
            if($forum_type['alliance'] != $session->alliance){
            } else if($forum_type['forum_area'] == 3){

            }

        } else {
            header("Location: ".$_SERVER['PHP_SELF']);
        }
    }
}

1 ответ 1

1
if(isset($_GET['s'])){
    header("Location: ".$_SERVER['PHP_SELF']."?s=".preg_replace("/[^a-zA-Z0-9_-]/","",$_GET['s']));
}else if(isset($_GET['aid'])){
    header("Location: ".$_SERVER['PHP_SELF']."?aid=".preg_replace("/[^a-zA-Z0-9_-]/","",$_GET['aid']));

Дословно это значит:

  • Если есть параметр GET 's', перенаправить на эту же страницу с немного перефильтрованным параметром GET 's'
  • Если есть параметр GET 'aid', перенаправить на эту же страницу с немного перефильтрованным параметром GET 'aid'

как только появляется параметр s или aid, скрипт начинает пересылать пользователя на самого себя опять с параметром s или aid, чтобы снова перенаправить, чтобы снова обнаружить параметр s или aid...

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.