derek.sullivan, on Aug 27 2009, 01:38 PM, said:
<?php
$n = trim($_GET['n']);
if ($n) { // or if (isset($n))
include($n.".php");
}else{
die("error!");
}
?>
Note, you should be careful using isset() as it will return true as long as the variable is set to something other than null (i.e. an empty string).
Ref:
http://php.net/manua...ction.isset.php
derek.sullivan, on Aug 28 2009, 07:04 AM, said:
if ($i != 'error') try this instead
if ($i !== 'error')
== is equal to.
!= is not equal to, !== is not identical to.
Ref:
http://php.net/manua....comparison.php
What i would recommend doing is this:
$n = str_replace('.', '', trim($_GET['n']));
if(file_exists($n)){
include $n.'.php';
}else{
include 'modules/news.php';
}
If that doesn't work, you should make sure the path $n.'.php' points to the correct file.