Re: simple page not found 404 script - PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2007. 03. 30, péntek keltezéssel 19.01-kor Dwayne Heronimo ezt írta:
> wierd.. your code is behaving exactly the same as mine did.
> it will display the error and the page.. but both at the same time :S
> 
> it is working but somehow it continues to execute.
> 
> http://arubaguide.org/arubaguide/categories.php?catcode=art
> 
> http://arubaguide.org/arubaguide/categories.php?catcode=blabla
> 
> 
> 
> "Davi" <davividal@xxxxxxxxxxxxxxxx> wrote in message 
> news:200703301349.42836.davividal@xxxxxxxxxxxxxxxxxxx
> Em Sexta 30 Maro 2007 13:42, Dwayne Heronimo escreveu:
> > Yes but this file does not exist. It is just to use for my queries. so I
> > think I cannot use the file_exists function. Which other function I would
> > use to do this?
> > I already have setup the .htaccess file to point also to a 404 page. but
> > this works only if the URL is totally wrong. like 
> > www.arubaguide.org/blabla
> > but not www.arubaguide.org/categories.php?catcode=blabla
> >
> >
> 
> Try something like that:
> 
> <?php
> 
> define("HTML","html/");
> 
> define("INC","inc/");
> 
> $ext = array ("php","html","htm");
> 
> $exists = false;
> 
> foreach($ext as $file_ext) {
> 
> if ( file_exists ( HTML.$_GET["catcode"].".".$file_ext ) )
> {
> $exists = true;
> break;
> }
> }
> 
> if ( ! ( $exists ) ){
> include ( "404.php" );
don't forget the exit here:
exit;

that's why it displays all the stuff later on

greets
Zoltán Németh


> }
> else {
> include ( HTML.$_GET["catcode"].".".$file_ext );}
> 
> ?>
> 
> 
> -- 
> Davi Vidal
> davividal@xxxxxxxxxxxxxxxx
> davividal@xxxxxxxxx
> --
> 
> Agora com fortune:
> "[Peter and his friends have formed a rock band and are performing at a
> prison]
> Peter Griffin:  [shouting into microphone] Hello, Cleveland!
> Cleveland:  Hello, Peter.
> Quagmire:  [clapping drum sticks together] One, two, three, *four*!
> Peter Griffin:  [small amount of time passes] Oh, my God. We don't know any
> songs. [prisoners get mad] " 
> 

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux