simple page not found 404 script - PHP



Dear All,

I have made a simple php script that will show an 404.php error page when an
item is removed.

You can see the page here:
http://arubaguide.org/arubaguide/categories.php?catcode=art

But some how this is not working. It is displaying the 404 page and the
normal page.


<?php

/* function to get an external file into a vatiable */
function get_include_contents($filename) {
if (is_file($filename)) {
ob_start();
include $filename;
$contents = ob_get_contents();
ob_end_clean();
return $contents;
}
return false;
}

/* configuration file */

$errormsg = get_include_contents('404.php');
$pagename = $_GET['page'];

/* end configuration file */

if(file_exists("$pagename"))
{
include "$pagename";
}
else
{
echo "$errormsg";
}
?>

is the $pagename not enough for this script?

Let me know..

Dwayne
.



Relevant Pages

  • Re: Large File Not Being Sent To Client
    ... I tried changing the php script to do fopen, fread, echo, ... The messages in the log file stop at 10MB, ... Without the header the browser is free to figure on it's own how long the data should be. ...
    (comp.lang.php)
  • Re: help! what should I do when there is a segmentation fault in my php script
    ... i also tried to insert some echo or print ... but there's not any thing but segfault in the screen. ... but some php script works well.:.those not so complex. ... What webserver program do you use? ...
    (alt.php)
  • Large File Not Being Sent To Client
    ... My company produces reports for our customers in PDF format. ... I tried changing the php script to do fopen, fread, echo, ... The messages in the log file stop at 10MB, ...
    (comp.lang.php)
  • Re: Large File Not Being Sent To Client
    ... I tried changing the php script to do fopen, fread, echo, ... After each flush, I write a message to a log ... The messages in the log file stop at 10MB, ...
    (comp.lang.php)
  • Re: first even php code
    ... > This is my first ever, ever PHP script. ... the first call would close the connection to the database, ... echo ''.tt; ... //Close the database connection ...
    (comp.lang.php)