Re: [PHP] simple page not found 404 script - PHP



2007. 03. 30, péntek keltezéssel 14.45-kor Dwayne Heronimo ezt írta:
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.

in the above link you do not give a "page" parameter at all... so from
where should the script get it?

greets
Zoltán Németh



<?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

  • PHP scripting errror -Why?
    ... Does anyone see what I am doing wrong with this simple script? ... >> So the PHP script IS running, and I am receiving an email... ... > be the HTML back to the browser. ... that the headercommand redirects the user back to the page they were ...
    (alt.php)
  • Re: [PHP] Re: how to detect type of image
    ... you detect if a script is HTML or PHP? ... to execute a file that starts with 'GIF89a' as if it were a binary ... manage to trick your PHP script into putting it somewhere that it will ... Every extra barrier you layer in there will slim down the number of ...
    (php.general)
  • Re: [PHP] pdo-oracle + nls_lang environment variable...
    ... I'm using pdo-oci on php-5.2.2 against an oracle-10g server, ... I make a simple php script that makes a select from a table. ... user running the apache daemon, I modified the apache init script to export ...
    (php.general)
  • Re: getting "chmod(): Operation not permitted" on attempted file changes
    ... I upload files thru this script, ... so only "nobody" may edit the file. ... sets the permissions appropriately, if you still need the PHP script ...
    (alt.php)
  • Re: Cant insert spreadsheet edited in Linux with PHP script
    ... (The script follows here in a sec.) ... Then use the PHP script to ... > I don't think it's file folder or structure issue, because I'll edit it ... > in one of the three programs and then copy it to a WindowsXP machine ...
    (comp.lang.php)