Another thing, if someone can, when a bad URL is typed in, and there actually is NOT a file where the URL suggests, it shows the typical PHP errors: parse error, can't find whatever/whatever/blah.php
Here is the code I'm using:
Code: Select all
<?php
$url = '';
if (!empty($_GET['site'])) {
$url .= $_GET['site'] . '/';
}
if (!empty($_GET['category'])) {
$url .= $_GET['category'] . '/';
}
if (!empty($_GET['page'])) {
$url .= $_GET['page'] . '.php';
}
if (!empty($_GET['product'])) {
$url .= $_GET['product'] . '.php';
}
?>
<?php
if ( !empty($_GET['page']) || !empty($_GET['product']) || !empty($_GET['site']) || !empty($_GET['category']) ) {
include $url;
} else {
include ('main/home.php');
}
?>Code: Select all
<?php
$page = $_GET['page'];
$pages = array('page1', 'page2', 'page3');
if (!empty($page)) {
if(in_array($page,$pages)) {
$page .= '.php';
include($page);
}
else {
echo 'Page not found. Return to
<a href="index.php">index</a>';
}
}
else {
include('page1.php');
}
?>Any help would be greatly appreciated.