This code have some problem of Security? is a correct way to make a query string ?
I don't usually use this type of code, so my question.
<?php
$id = $_REQUEST['id'];
?>
<?
switch($id) {
case "principal":
$pagina = "pag.php";
break;
case "perfil":
$pagina = "secure.php";
break;
default:
$pagina = "home.php";
break;
}
?>
<?
if( (isset($pagina)) and (file_exists($pagina)) ) {
include($pagina);
} else {
echo "Page error";
}
?>
require_onceis much better practise instead ofincludeand try to useintvalif it possible (in your ids)require_once, it takes a little longer than require and if your app is organized correctly you shouldnt need it.