'; echo 'direct call to php'; } else { header("Location: /"); } die(); } } // Parse Request if (! isset($_SERVER ['REQUEST_URI'])) $_SERVER ['REQUEST_URI'] = ''; $script = parse_url ($_SERVER ['REQUEST_URI']); // Default page if ($script['path'][strlen($script['path'])-1] == '/') $script['path'] = $script['path'].'hp.php'; if (empty($script['path'])) $script['path'] = $script['path'].'/hp.php'; // get script parts $script_parts = explode ("/", $_SERVER ['REQUEST_URI']); // clean empty keys foreach($script_parts as $key=>$row) if ($row == '') unset($script_parts[$key]); // sort $tmp = array(); foreach($script_parts as $row) { $tmp[] = $row; } $script_parts = $tmp; if(empty($script_parts)) $script_parts[] = "hp"; // set origin if(isset($_GET['o']) && strlen($_GET['o']) < 255) { if(!isset($_SESSION['origin']) || $_SESSION['origin'] != $_GET['o']) $_SESSION['origin'] = $_GET['o']; header("Location: /"); die(); } if(!isset($_SESSION['origin'])) $_SESSION['origin'] = "unknown"; // parsing directories if (count($script_parts)) switch ($script_parts[0]) { case "taf": $script['path'] = '/taf.php'; break; } // Execute Script if (substr($_SERVER['DOCUMENT_ROOT'], -1, 1) == '/') $_SERVER['DOCUMENT_ROOT'] = substr($_SERVER['DOCUMENT_ROOT'], 0, -1); if ($script['path'][0] == '/') $script['path'] = substr($script['path'], 1); if (file_exists ($_SERVER['DOCUMENT_ROOT'].'/'.$script['path'])) { // includes include($_SERVER['DOCUMENT_ROOT'].'/'.$script['path']); } else { // error 404 if (DEBUG) { echo $_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI'].'
'; echo 'error 404'; } else { header("Location: /"); die(); } } // Output HTML $html = ob_get_clean(); // Any post processing html changes here ob_start('ob_gzhandler'); //header("Content-type: text/html; charset=UTF-8"); echo $html; ?>