0 Tessa Posted July 29, 2016 Posted July 29, 2016 You probably use $_GET to get something from the empty URL. Quote
0 l2cabal Posted July 30, 2016 Author Posted July 30, 2016 You probably use $_GET to get something from the empty URL. http://www.mediafire.com/download/c96fwa2x2an1pfm/Web%282%29.rar u could of a look. because I do not understand very well site What do I could do to try to fix this error? I found this php here's a look <?php switch($_GET['pag']){ default: include "home.php"; break; case 'info': include "info.php"; break; case 'cp_registro': include "cp_registro.php"; break; case 'cp_mudar': include "cp_mudar.php"; break; case 'cp_recuperar': include "cp_recuperar.php"; break; case 'downloads': include "downloads.php"; break; case 'doacoes': include "doacoes.php"; break; case 'e_geral': include "e_geral.php"; break; case 'e_clans': include "e_clans.php"; break; case 'e_sieges': include "e_sieges.php"; break; case 'doacoes_confirmar': include "doacoes_confirmar.php"; break; case 'donate': include "donate.php"; break; case 'chat': include "chat.php"; break; } ?> Quote
0 Tessa Posted July 30, 2016 Posted July 30, 2016 (edited) Check if isset($_GET['pag']), so if it is - get to the switch, else include the default page. Edited July 30, 2016 by Tessa Quote
0 iAlreadyExist Posted July 30, 2016 Posted July 30, 2016 try my metod :) <?php $script = basename( $_GET['page'] ); $dir = 'pages/'; $file = $dir . $script . '.php'; if ( !file_exists( $file ) ) { $file = $dir . 'default.php'; } require( $file ); ?> link will be index.php?page=contacts Quote
0 Tessa Posted July 30, 2016 Posted July 30, 2016 (edited) try my metod :) <?php$script = basename( $_GET['page'] );$dir = 'pages/';$file = $dir . $script . '.php';if ( !file_exists( $file ) ) { $file = $dir . 'default.php';}require( $file );?>link will be index.php?page=contactsYou will still get this notice if $_GET is empty. So, use isset() which checks if 'page' is in the array. if (isset($_GET['page'])) { // Code depending on $_GET here... }I would suggest Symfony's HttpFoundation which takes care about the request/response. Edited July 30, 2016 by Tessa Quote
Question
l2cabal
5 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.