Russia Posted November 4, 2009 Share Posted November 4, 2009 How do I do it so like I have a navigation bar with links. Like one link is like blah.php?page=about for the about page, and it loads blah.php?p=about with the about html blah.php?p=index with the homepage html I dont know whats it called I think its called like dynamic php. Link to comment https://forums.phpfreaks.com/topic/180211-how-to-do-blahphppageblah/ Share on other sites More sharing options...
Garethp Posted November 4, 2009 Share Posted November 4, 2009 http://www.workingwith.me.uk/articles/scripting/mod_rewrite http://www.tizag.com/phpT/postget.php http://php.net/manual/en/function.include.php Those links should help Link to comment https://forums.phpfreaks.com/topic/180211-how-to-do-blahphppageblah/#findComment-950658 Share on other sites More sharing options...
Russia Posted November 4, 2009 Author Share Posted November 4, 2009 Nope none of them do. Link to comment https://forums.phpfreaks.com/topic/180211-how-to-do-blahphppageblah/#findComment-950664 Share on other sites More sharing options...
Garethp Posted November 4, 2009 Share Posted November 4, 2009 No, those are exactly what you want. The second one deals with the ?p=blah, the third one helps you to load blah.html and the first one is an alternative method Link to comment https://forums.phpfreaks.com/topic/180211-how-to-do-blahphppageblah/#findComment-950669 Share on other sites More sharing options...
HaLo2FrEeEk Posted November 4, 2009 Share Posted November 4, 2009 You should note, however, that having an open include like that is EXTREMELY unsafe. Let's say you want someone to put in: blah.php?page=about.html And you have a file called config.php in the same directory, a person could put in: blah.php?page=config.php And get all the information from that page. Make sure you sanitize your inputs. Link to comment https://forums.phpfreaks.com/topic/180211-how-to-do-blahphppageblah/#findComment-950671 Share on other sites More sharing options...
Garethp Posted November 4, 2009 Share Posted November 4, 2009 I personally would use an array of allowed inputs and use an if(is_inarray($_GET['p'])) Link to comment https://forums.phpfreaks.com/topic/180211-how-to-do-blahphppageblah/#findComment-950678 Share on other sites More sharing options...
HaLo2FrEeEk Posted November 4, 2009 Share Posted November 4, 2009 Exactly, or if you want to allow the person to access only, say, html files in the same directory, you can read the directory for files, then use a foreach loop to add all pages with an html extension to an array, and there's your dynamically generated allow array. Link to comment https://forums.phpfreaks.com/topic/180211-how-to-do-blahphppageblah/#findComment-950720 Share on other sites More sharing options...
Gayner Posted November 4, 2009 Share Posted November 4, 2009 easy, use $_GET['lol']; then &lol=bla bla Link to comment https://forums.phpfreaks.com/topic/180211-how-to-do-blahphppageblah/#findComment-950721 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.