mistake I can’t explain the name or the cause

Asked

Viewed 51 times

0

I believe it is not an error, more a ma structure in the checks of the pages recently adapted a friendly url on my site, then I decided to implemtar a search system with ajax, in the home of the site it works right as you can see in the image

inserir a descrição da imagem aqui

however when I go to another page of the site and try to do a search, he adds to busca.php and save my entire page as per the image

inserir a descrição da imagem aqui

Someone knows what’s going on ?

index php.

include_once("sql/config.php");
if(isset($_GET['url'])){

    $url  = $_GET['url'];

    $urlE = explode('/',$url);

}

if(isset($urlE[0])){

    $arquivo = $urlE[0];

}elseif(isset($urlE[0]) || isset($urlE[1])){

    $arquivo = $urlE[0];

    $post    = $urlE[1];

}


$paginas = array('contato');


//verifica se a pagina existe no meu diretorio

if(isset($arquivo) && in_array($arquivo,$paginas)){

    include_once "includes/$arquivo.php";

    echo "aqui";

}
//se nao existir nada na minha url, manda para a home
elseif(!isset($urlE[0])){

    include_once "includes/home.php";

    echo "aqui home";

}
//caso nao exista no meu diretorio, mais esteja cadastrado no banco de dados
else{

    include_once "includes/generos.php";

    echo "aqui generos";

}

is falling into the if calling the page generos.php

I changed my last else even though it didn’t work

else{

if($urlE == 'busca'){

}else{
    include_once "includes/generos.php";
        echo "aqui generos";
    }

}

before I was calling my pages only with include then I thought the problem was this, I did a research and I found here an explanation about include, include_once, require and require_once that Maniero did, so I changed everything to include_once, but did not solve my problem

  • Mayron, I think this index controller of yours is a little fuzzy. Probably (I don’t know if that’s it) the search screen is falling in more 1 IF and why it’s probably duplicating and causing bugs even in ajax. Give a few echo "aqui"; inside ifs you’ll find the bug.

  • @Andreicoelho really is falling into one of if, I don’t know what to do, would have some hiccup ?

  • I would need to better understand your url. There are ways you can show the url in the case that works and the url in the cases that the bug happens?

  • @Andreicoelho the search is falling in the last Else, no matter which url is in, this url that generates the page generos.php comes from the bank

  • I think the problem is here: if($urlE == 'busca'){ ... actually is if($urlE[0] == 'busca'){ ... try like this.

  • Because when you give a bang. It turns the string into an array.

  • @Andreicoelho same thing, has not changed anything, what strange

Show 3 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.