forked from I2P_Developers/i2p.www
silly silly
(duck)
This commit is contained in:
17
index.php
17
index.php
@@ -6,28 +6,27 @@ define('PAGE_DIR','pages/');
|
||||
define('PAGE_EXT','.html');
|
||||
|
||||
/* Filter out everything except alphanumerical characters and underscores */
|
||||
function form_filter($data) {
|
||||
return preg_replace('/[^[:alnum:]_]/','',$data);
|
||||
function form_dirty($data) {
|
||||
return preg_match('/[^[:alnum:]_]/',$data);
|
||||
}
|
||||
|
||||
$page = '';
|
||||
if(isset($_REQUEST['page'])) {
|
||||
$page = form_filter(urldecode($_REQUEST['page']));
|
||||
$page = urldecode($_REQUEST['page']);
|
||||
} else {
|
||||
$page = 'home';
|
||||
}
|
||||
$site_structure = parse_ini_file(MENU_FILE, true);
|
||||
$pagetitle = getpagetitle($page);
|
||||
|
||||
if(is_readable(PAGE_DIR.$page.PAGE_EXT)) {
|
||||
if(!form_dirty($page) and is_readable(PAGE_DIR.$page.PAGE_EXT)) {
|
||||
$site_structure = parse_ini_file(MENU_FILE, true);
|
||||
$pagetitle = getpagetitle($page);
|
||||
include(PAGE_DIR.'header'.PAGE_EXT);
|
||||
include(PAGE_DIR.$page.PAGE_EXT);
|
||||
include(PAGE_DIR.'footer'.PAGE_EXT);
|
||||
} else {
|
||||
header("HTTP/1.0 404 Not Found");
|
||||
include(PAGE_DIR.'header'.PAGE_EXT);
|
||||
print "<h1>Error: Page \"$page\" not found</h1>";
|
||||
include(PAGE_DIR.'footer'.PAGE_EXT);
|
||||
print "<h1>Error: Page not found</h1>\n";
|
||||
print "<a href=\"javascript:history.back(1)\">Go back</a>";
|
||||
}
|
||||
|
||||
?>
|
||||
|
Reference in New Issue
Block a user