PHP error or just my error
Posted by: matta
Posted on: 2009-05-31 13:38:00
<?php
if (isset($_GET['page']) && file_exists("{$_SERVER['DOCUMENT_ROOT']}/includes/{$_GET['page']}.php")) {
include("{$_SERVER['DOCUMENT_ROOT']}/includes/{$_GET['page']}.php");
} else {
include("{$_SERVER['DOCUMENT_ROOT']}/includes/sorry.php");
}
?>
Either I'm forgetting a line or just completely forgetting something. index.php is my main page and I was wanting some welcoming text. Well of course when they click a link it will point to the file and pull it up, but say the file don't exists than it will pop up the sorry.php page. Hope I made it clear enough
Matta
EDIT: Easier way...I had it as home.php, but I didn't want someone clicking a link when it was bad and taking them back home. I rather have a page explaining either the page didn't exist or something else was wrong.Edited by matta on 05/31/09 01:44 PM (server time).