Redirection ne marche pas
Bonjour,
Voici mon code !
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| if ( $_SERVER['REQUEST_URI'] == '/' ) $page = 'home';
else {
$page = substr($_SERVER['REQUEST_URI'], 1);
if ( !preg_match('/^[A-z0-9]{3,15}$/', $page) ) not_found();
}
$CONNECT = mysqli_connect('localhost', 'root', '', 'db');
//if ( !$CONNECT ) exit('MySQL error');
session_start();
if ( file_exists('all/'.$page.'.php') ) include 'all/'.$page.'.php';
else if ( $_SESSION['id'] and file_exists('auth/'.$page.'.php') ) include 'auth/'.$page.'.php';
else if ( !$_SESSION['id'] and file_exists('guest/'.$page.'.php') ) include 'guest/'.$page.'.php';
else if ( $_SESSION['admin'] and file_exists('admin/'.$page.'.php') ) include 'admin/'.$page.'.php' |
Lorsque je clique sur un lien, je devrais être redirigé vers l'url demandé avec include. Or, le serveur me dit que l'url n'existe alors qu'il existe dans mon dossier. Pouvez-vous m'aider svp.
Merci d'avance !