...

View Full Version : PHP Problem Please Help!



U'ziel
09-20-2005, 09:03 PM
I'm having a strange problem with the site im trying to build. its basically a template index page consisting of nav, graphic, poll etc which calls includes into its main area that make up the body of the page you want to view. i.e index.php?pageid=news for the news page etc. these files are stored in a sub directory called /pages. the index page checks that the file exists in the dir if not bounces you to the news page, fairly straight forward so far?

example links:

http://www.insecureinc.com/index.php?pageid=adminarea (takes you to the admin area login screen)

http://www.insecureinc.com/index.php?pageid=fakepage (bounces you to news - feel free to try another word)

this is where my problem becomes a little more bizzare, when you click this link you will see why..
http://www.insecureinc.com/index.php?pageid=admin

it doesnt bounce you to the news page it just displays a blank the weird thing is though i was using pageid=admin originally before it mysteriously stopped working so i changed my code references to adminarea and like magic, started working again. heres my code..

on page load:

//CHECK TITLE
$check_title = "./pages/".$pageid.".inc";
if (file_exists($check_title)) {
$title = $pageid;
} else if($pageid == "adminarea") {
$title = "admin";
} else {
$title = "news";
}


in the page "content section":


<?
$check_files = "./pages/".$pageid.".inc";
if (file_exists($check_files)) {
include("./pages/".$_GET[pageid].".inc");
} else if($pageid == "adminarea") { include("./admin/admin.inc");
} else {
include("./pages/news.inc");
}
?>


I'm using a seperate exception for the admin bit to mask the URL for anyone who might guess. I basically cant understand why the old "admin" id is still showing up, or why it stopped accepting the includes in the first place, could an external file be causing this? please help!

P.S. I dont want to use the switch statement thats not the issue here.

U'ziel
09-22-2005, 01:06 PM
*bump*

Fou-Lu
09-23-2005, 10:26 AM
I don't understand, it appears to be working correctly for me. Is it possible you were running a cached version of the page?
Pageid = admin takes me to news, pageid = adminarea takes me to login. Thats how you need it correct?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum