All pastes #366078 Raw Edit

Mortal

public php v1 · immutable
#366078 ·published 2007-02-21 14:32 UTC
rendered paste body
<?php // Assign the requested page to a shorter variable for simplicity.// The value of $_GET["page"] will be obtained from index.php?page=RIGHT_HERE$p = $_GET["page"];// Check for bad requests.  This is a security measure.if (strpos($p,"..")) {  // A bad request has been made, exit immediately. Do not proceed with the inclusion.  die("Bad page request");}// File to include. If $p is empty, fall back to // main.php. THIS FILE MUST EXIST.$p = trim($p); // trim whitespaceif (empty($p)) $p = "main.php";else {  $p .= '.php';  if (!file_exists($p)) $p = '404.php';}$content_file=$p;/*<Mortal> I've commented out this block since main.php has to exist, as your comments say. We won't be checking if it exists.// See if $content_file exists. If it does not, redirect to the homepage.if (!file_exists($content_file)) {  //if I comment out this header line then the error goes away  //but I see only the header and not anything else  header("Location: {$_SERVER["PHP_SELF"]}");   exit();}*/?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">	<head>    		<meta http-equiv="Content-type" content="text/html; charset=utf-8" />    		<meta http-equiv="Content-Language" content="en-us" />    		<link href="index.css" rel="stylesheet" type="text/css">    		<title><?=$title ?></title>		</head>		<body>			<div id="container">				<div id="header"><?php include("header.php"); ?></div>									<div id="menu"><?php include("menu.php"); ?></div>									<div id="content"><?php include($content_file); ?></div> 				<div id="footer"><?php include("footer.php"); ?></div>			</div>			</body></html>