error when url has more parameters

Asked

Viewed 17 times

0

I’m doing a user-friendly url forwarding with page access verification per database, but I have a problem when the URL has more parameters on it, like if the URL looks like this www.site.com/a/b/c blz works, but if you enter one more item in the url www.site.com/a/b/c/d, he keeps trying to direct

Code

if ($_GET) {
    $URL = explode('/', $_GET['p']);

    $conRouters = mysqli_query($conn, "SELECT * FROM acesso_pagina WHERE slug = '$URL[0]'");

    $linhas = $conRouters->num_rows;

    if ($linhas > 0) {
        $dados = mysqli_fetch_array($conRouters);
        $uPagina    = $dados['url_pagina'];
        $slug       = $dados['slug'];
        $nPagina    = $dados['nome_pagina'];

        if ($URL[0] == $slug) {

            if (empty(permission($_SESSION['status_user']))) {
                include_once(BLOCK);
                // exit();
            } else {

                include_once($uPagina);
            }
        } else {
            include_once(noExist);
        }
        $conRouters->close();
    } else {
        include_once(noExist);
    }
    $conn->close();
} else {
    $URL = 'dashboard';
    include_once($URL . '.php');
}
  • Problem solved...

No answers

Browser other questions tagged

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