Re: simple page not found 404 script - PHP
| From: | Dwayne Heronimo | Date: | Fri, 30 Mar 2007 13:56:17 +0000 |
| Subject: | Re: simple page not found 404 script - PHP | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-251739@lists.php.net to get a copy of this message | ||
When I echo the $pagename it returns the correct string. I also tried to
rename the $pagename to something I am sure that wouldn't come up in other
scripts.
One thing that is coming up in other scripts is the $_GET['catcode'] because
I am using queries with this to show the categories.
wierd i tried renaming the
""Zoltán Németh"" <znemeth@alterationx.hu> wrote in message
news:1175262041.5023.62.camel@zoli-desktop...
> well, I don't know what may be wrong...
> try echoing out $pagename
> and is your script only this? or are there other parts? if so, those
> other parts might be screwing things up...
>
> greets
> Zoltán Németh
>
> 2007. 03. 30, péntek keltezéssel 15.36-kor Dwayne Heronimo ezt írta:
>> hey zoltan,
>>
>> I used your code but this still is displaying both the 404 and the normal
>> page:
>>
>>
>> http://arubaguide.org/arubaguide/categories.php?catcode=activities
>>
>>
>> <?php
>> $pagename = $_GET['catcode'];
>> if(file_exists("$pagename")) {
>> include "$pagename";
>> } else {
>> include "404.php";
>> }
>> ?>
>>
>>
>>
>> ""Zoltn Nmeth"" <znemeth@alterationx.hu> wrote in message
>> news:1175260687.5023.56.camel@zoli-desktop...
>> > 2007. 03. 30, pntek keltezssel 15.10-kor Dwayne Heronimo ezt rta:
>> >> 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";
>> >> }
>> >> ?>
>> >>
>> >
>> > actually I don't know what the problem is, but I would do it in a much
>> > shorter way:
>> >
>> > $pagename = $_GET['catcode'];
>> > if(file_exists("$pagename")) {
>> > include "$pagename";
>> > } else {
>> > include "404.php";
>> > }
>> >
>> > about your original question, the script looks basically okay... what
>> > is
>> > the error you get?
>> >
>> > greets
>> > Zoltn Nmeth
>> >
>> >>
>> >>
>> >> ""Zoltn Nmeth"" <znemeth@alterationx.hu> wrote in
>> >> message
>> >> news:1175259498.5023.49.camel@zoli-desktop...
>> >> > 2007. 03. 30, pntek keltezssel 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:
>> >> >> ê¯
>> >> >> Þ~ð©쟾/üipñ£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
>> >> > Zoltn Nmeth
>> >> >
>> >> >>
>> >> >>
>> >> >> <?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
>> >> >>
>> >>
>>