Click on a link

Home Feedback Other non-existant page


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Include via URL</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>

<body>
<p>Click on a link</p>
<p><a href="?page=home">Home</a> <a href="?page=feedback">Feedback</a> <a href="?page=other">Other</a> <a href="?page=nofile">non-existant</a> <a href="?dir=folder1&page=page2">page</a> </p>
<hr />
<?
/* Take the value from variable "page" and incude it into this document.
e.g index.php?page=home
page=home
include home.php
*/
if (isset($page)){
    if(!
$dir){
    
$dir '.';
    }
    
$fn "$dir/$page.php";
if(
file_exists($fn)){    
echo 
$fn;
include 
$fn;

}
else {
echo 
"<h1>The file $fn does not exist</h1>";
}
}
?>
</body>
</html>
<? show_source(__FILE__); ?>