justinh Posted August 21, 2009 Share Posted August 21, 2009 I was wondering if you guys could tell me if this is an okay way to go about loading different pages. index.php <?php isset($_GET['page']) ? $page = $_GET['page'] : $page = "main"; include($page.".php"); ?> And I would keep the pages in the same directory as index.php Link to comment https://forums.phpfreaks.com/topic/171233-question/ Share on other sites More sharing options...
ToonMariner Posted August 21, 2009 Share Posted August 21, 2009 nope - someone could put page=http://theirsite.com/nasty which would then allow that script access to your server. you are better defining the full path to a script in any include/require staement like so <?php $dir = $_SEVER['DOCUMENT_ROOT'] . 'path/to/your/dir/'; isset($_GET['page']) ? $page = $_GET['page'] : $page = "main"; include($dir . $page.".php"); ?> but MANY better ways of implementing this functionality... Link to comment https://forums.phpfreaks.com/topic/171233-question/#findComment-902970 Share on other sites More sharing options...
justinh Posted August 21, 2009 Author Share Posted August 21, 2009 Oh your right! So in a perfect world this would be fine. But we have people that do mean things Link to comment https://forums.phpfreaks.com/topic/171233-question/#findComment-902976 Share on other sites More sharing options...
ToonMariner Posted August 21, 2009 Share Posted August 21, 2009 I like to see as people will punish you for not taking care of your code... its not their fault you build massive holes in YOUR security. Link to comment https://forums.phpfreaks.com/topic/171233-question/#findComment-902981 Share on other sites More sharing options...
justinh Posted August 21, 2009 Author Share Posted August 21, 2009 So you're saying you LIKE it when people find vulnerabilities in other people's code, and exploit it? I don't quit understand your reply. Link to comment https://forums.phpfreaks.com/topic/171233-question/#findComment-902985 Share on other sites More sharing options...
ToonMariner Posted August 21, 2009 Share Posted August 21, 2009 no I don't like it when security holes are exposed - I am just saying that its the developers fault and sometimes the only way they learn is when they get stung. Link to comment https://forums.phpfreaks.com/topic/171233-question/#findComment-902989 Share on other sites More sharing options...
justinh Posted August 21, 2009 Author Share Posted August 21, 2009 Noted sir. Thanks for your insight and helpfulness, I appreciate it. Link to comment https://forums.phpfreaks.com/topic/171233-question/#findComment-902990 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.