Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/concept/public_html/admin/index.php on line 50
heres my php code
<?php
$val = $_GET['id']; // Replace id with whatever you want to use, eg ?id=page
$val .= '.php'; // Makes the filename complete so if you called ?id=index, it would be index.php it has to look for
$dirty = array('..');
$clean = array('');
$val = str_replace($dirty, $clean, $val); // Prevent people from viewing root files like your password (should work i just quikly added it without testing)
if(isset($_GET['id'])){ // Replace id with whatever you want to use, eg ?id=page
if(file_exists($val)){ // This checks if the file you are trying to call exists
include '$val';
}
else{
include '404.php'; // If the file doesnt exists it calls your 404 error page
}
}
else{
include 'admin.php'; // If ?id= is not set it will now go to your news page
}
// Include this script in your content area
// Run ?id=pagename (without .php) to view a page
?>
Edited by zetsumei, 14 August 2006 - 09:48 PM.
