, ...
- , "
images/../../secret
" , - , "
index
" .
, , , (, "includes
" "templates
" ). , , .
if (preg_match('/^[a-z0-9]+$/', $_GET['page'])) {
$page = realpath('includes/'.$_GET['page'].'.php');
$tpl = realpath('templates/'.$_GET['page'].'.html');
if ($page && $tpl) {
include $page;
include $tpl;
} else {
}
} else {
}
: realpath
, , false
. file_exists
.