fallenone1884 Posted September 12, 2006 Share Posted September 12, 2006 Ok i have this code, im not sure entirley how it works, but know it works for what i am doing, including different pages inside my main.php page. My question is there anyway to make it pull from two directory's instead of just /pages/ i think its making it so only one directory is available for the function for security. So in keeping with security but opening the call for more then one directory, is it possible? and how do i go about doing it. I can clarify if asked, i stumble accross my own thoughts alot..Thanksoh heres the code[code]<p align="center"> <?php$p = $_GET['p'];if ( !empty($p) && file_exists('./pages/' . $p . '.php') && stristr( $p, '.' ) == False ) { $file = './pages/' . $p . '.php';}else{ $file = './pages/welcome.php';}include $file;[/code] Quote Link to comment Share on other sites More sharing options...
ronverdonk Posted September 12, 2006 Share Posted September 12, 2006 Hope I understand correctly. Assume that you want your welcome page to come from another directory, say MyDirectory, which is one level up in the tree, just specify in your ELSE clause:[code]else{ $file = '../MyDirectory/Welcome.php';}[/code]Ronald 8) Quote Link to comment Share on other sites More sharing options...
fallenone1884 Posted September 12, 2006 Author Share Posted September 12, 2006 Sorry for being unclear, Im looking to do something like thismain.php?p=apagethe directory of this page named /pages/that works with this codeseeing, that [color=brown]file_exists('./pages/' . $p . '.php') and $file = './pages/' . $p . '.php';[/color] are calling for the pages directory.what i want to do is do the same thingmain.php?p=anotherpagethe directory of anotherpage named /anotherdir/ when i try to do this, nothing comes up, because im assuming, anotherpage is not in the pages directory.I dont know, i just started all this last night, so trying to figure it out, sorry if im not relaying the information right.My question is there a way to add the second directory so that when i domain.pgp?p= it looks in both the pages directories and the anotherdir directory, not just pages. Quote Link to comment Share on other sites More sharing options...
fallenone1884 Posted September 13, 2006 Author Share Posted September 13, 2006 Ok got it, just use an [code]elseif[/code]:)works great Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.