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



I think I'm missing something, but this works:

http://arubaguide.org/arubaguide/index.php?page=advertise

and if I put in a type such as:

http://arubaguide.org/arubaguide/index.php?page=advertisd

I get the 404 error page.
I think the problem with using $_GET[catcode]???


On 30/03/07, Dwayne Heronimo <dwayne@xxxxxxxxxxxxxxx> wrote:


indeed.. it should be catcode instead of page.:-(. but still its not
working
:S



<?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['catcode'];

/* end configuration file */

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



""Zoltán Németh"" <znemeth@xxxxxxxxxxxxxx> wrote in message
news:1175259498.5023.49.camel@xxxxxxxxxxxxxxx
> 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
>>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Relevant Pages

  • Re: [PHP] PHP console script vs C/C++/C#
    ... My script is taking a longer time to execute than I want. ... I prefer to write in PHP because that is what I know best. ... This is why I am thinking about rewriting my whole script in a C language. ... Perhaps there are different methods I could be using to speed up execution. ...
    (php.general)
  • Re: How to Add a Feeback Form
    ... I saw nothing in that script that indicates where the form is e-mailed to so ... Greg Maxey/Word MVP ... PHP or not. ... have the support available yet. ...
    (microsoft.public.frontpage.programming)
  • How best to show PHP source? (was: One page, multiple submit buttons)
    ... script to add to the top of a PHP script to enable showing its ... Maybe anybody submitting their own PHP code for critique here ... Anything posted to a newsgroup is a "snapshot" of what the ... there ought to be a FAQ for this ...
    (comp.lang.php)
  • Re: [PHP] PHP console script vs C/C++/C#
    ... My script is taking a longer time to execute than I want. ... I prefer to write in PHP because that is what I know best. ... thinking about rewriting my whole script in a C language. ... execution of the code. ...
    (php.general)
  • Email form script
    ... I have a web form that posts to a .php ... who cannot run .php on their server. ... Or does anyone have a .asp script that will ... Thank you for choosing FormToEmail by FormToEmail.com ...
    (microsoft.public.scripting.jscript)