Stupid question [pleas look at this]
Posted: Wed Jan 04, 2006 9:41 pm
Here is what I use now
And here is what geve me Maugrim_The_Reaper:
Which one is beter and how to use the second e.g. ?
maybe you can ugest somethiing better ! ?
Code: Select all
<?
$page=$_GET['page'];
$id = array(
'' => 'news.php',
'downloads' => 'downloads.php',
'news' => 'news.php',
'about' => 'about.php',
'lost' => 'lostpw.php',
'radio' => 'radio.php',
'lessons' => 'lessons.php',
'login' => 'login.php',
'register' => 'register.php',
'info' => 'data/userinfo.php',
'logout' => 'data/logout.php',
);
if (!isset ($id[$page])){
echo "ss";
}
else {
@include ($id[$page]);
}
?>Code: Select all
<?php $page = $_GET['id'];
if(!ctype_alnum($page)) // check whether the ID contains only letters and numbers
{
trigger_error('Error: Invalid Page ID passed as URL parameter. This may have been a hacking attempt!', E_USER_ERROR); // create a custom error message and exit the script (E_USER_ERROR is a custom fatal error)
}
require('/scripts/' . $page . '.php');
?>maybe you can ugest somethiing better ! ?