Re: simple page not found 404 script - PHP

From: Date: Fri, 30 Mar 2007 16:49:42 +0000
Subject: Re: simple page not found 404 script - PHP
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-251771@lists.php.net to get a copy of this message
Em Sexta 30 Março 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" ); } else { include ( HTML.$_GET["catcode"].".".$file_ext ); } ?> -- Davi Vidal davividal@siscompar.com.br davividal@gmail.com -- 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] "

« previous php.general (#251771) next »