where getting there .. now i have this.. but now it will only show the 404 page. I think somehow that the firstpart is not working? the include part? http://arubaguide.org/arubaguide/categories.php?catcode=activities <?php require_once('../Connections/arubaguide.php'); ?> <?php $cat_item = $_GET['catcode']; if(file_exists($cat_item)) { include "$cat_item"; } else { include "404.php"; exit; } ""Zoltán Németh"" <znemeth@xxxxxxxxxxxxxx> wrote in message news:1175270189.5023.70.camel@xxxxxxxxxxxxxxx > 2007. 03. 30, péntek keltezéssel 17.30-kor Dwayne Heronimo ezt írta: >> I tried every thing. But it works in a way. Because if I issue: >> http://arubaguide.org/arubaguide/categories.php?catcode=dghdfg >> >> it will display the 404 page but it all also continue to display the >> rest. >> >> And if you issue: >> http://arubaguide.org/arubaguide/categories.php?catcode=activities >> It will display also both. so the script is working but it is not >> stopping. >> >> Here is the complete code. This is the complete code just before the html >> tag. >> >> >> <?php require_once('../connections/arubaguide.php'); ?> >> >> <?php >> >> $cat_item = $_GET['catcode']; >> if(file_exists($cat_item)) { >> include "$cat_item"; >> } else { >> include "404.php"; >> } >> > > and that's exactly what I said. you display the 404 then continue > execution and the rest of your code displays some page. > you should have nothing executing after the error message. > like this: > > $cat_item = $_GET['catcode']; > if(file_exists($cat_item)) { > include "$cat_item"; > } else { > include "404.php"; > exit; > } > > greets > Zoltán Németh > >> if (!function_exists("GetSQLValueString")) { >> function GetSQLValueString($theValue, $theType, $theDefinedValue = "", >> $theNotDefinedValue = "") >> { >> $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : >> $theValue; >> >> $theValue = function_exists("mysql_real_escape_string") ? >> mysql_real_escape_string($theValue) : mysql_escape_string($theValue); >> >> switch ($theType) { >> case "text": >> $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; >> break; >> case "long": >> case "int": >> $theValue = ($theValue != "") ? intval($theValue) : "NULL"; >> break; >> case "double": >> $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : >> "NULL"; >> break; >> case "date": >> $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; >> break; >> case "defined": >> $theValue = ($theValue != "") ? $theDefinedValue : >> $theNotDefinedValue; >> break; >> } >> return $theValue; >> } >> } >> >> $colname_show_cat = "-1"; >> if (isset($_GET['catcode'])) { >> $colname_show_cat = (get_magic_quotes_gpc()) ? $_GET['catcode'] : >> addslashes($_GET['catcode']); >> } >> mysql_select_db($database_arubaguide, $arubaguide); >> $query_show_cat = sprintf("SELECT id, catcode, category_name, name, text, >> slogan, main_img FROM items WHERE catcode = %s ORDER BY name ASC", >> GetSQLValueString($colname_show_cat, "text")); >> $show_cat = mysql_query($query_show_cat, $arubaguide) or >> die(mysql_error()); >> $row_show_cat = mysql_fetch_assoc($show_cat); >> $totalRows_show_cat = mysql_num_rows($show_cat); >> ?> >> >> <?php >> function previewString($showcatvar) { >> >> $minitxt = $showcatvar; >> $len = strlen($minitxt); >> >> if ($len > 135) >> { >> $len = 135; >> } >> else >> { >> $len = $len; >> } >> >> $newstring = substr($minitxt,0,$len).' ...'; >> >> $previewtext = $newstring; >> >> return $previewtext; >> } >> ?> >> >> >> >> >> >> >> ""Zoltn Nmeth"" <znemeth@xxxxxxxxxxxxxx> wrote in message >> news:1175263890.5023.67.camel@xxxxxxxxxxxxxxx >> > 2007. 03. 30, pntek keltezssel 15.56-kor Dwayne Heronimo ezt rta: >> >> 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. >> > >> > where did you put that echo? you should put it right before the >> > if (file_exists("$pagename")) >> > row >> > btw, if you pass only the variable, you don't need those quotes around >> > it - they only consume resources in this case. so: >> > if (file_exists($pagename)) >> > >> > but I must admit I have no more ideas. if $pagename is correct right >> > before the if, and still both the if part and the else part gets >> > executed thats beyond my knowledge... >> > >> > one more thought: do you have any kind of code after this if? >> > maybe you just forget that you include some displaying part after it >> > and >> > that's making the confusion... >> > >> > greets >> > Zoltn Nmeth >> > >> >> >> >> wierd i tried renaming the >> >> ""Zoltn Nmeth"" <znemeth@xxxxxxxxxxxxxx> wrote in message >> >> news:1175262041.5023.62.camel@xxxxxxxxxxxxxxx >> >> > 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 >> >> > Zoltn Nmeth >> >> > >> >> > 2007. 03. 30, pntek keltezssel 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@xxxxxxxxxxxxxx> wrote in message >> >> >> news:1175260687.5023.56.camel@xxxxxxxxxxxxxxx >> >> >> > 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@xxxxxxxxxxxxxx> wrote in message >> >> >> >> news:1175259498.5023.49.camel@xxxxxxxxxxxxxxx >> >> >> >> > 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: >> >> >> >> >> 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 >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php