Schlo_50 Posted April 25, 2007 Share Posted April 25, 2007 I want to use $GET in order to bring up the content pages (e.g about.php) of my website onto the main (e.g index.php) page. Can someone post an example showing this please? Cheers Link to comment https://forums.phpfreaks.com/topic/48589-get/ Share on other sites More sharing options...
benjaminbeazy Posted April 25, 2007 Share Posted April 25, 2007 this is your index page, home is your main page content header is before content footer is after content <?php include "header.php"; if(isset($_GET['page'])){ $page = $_GET['page']; }else{ $page = "home.php"; } include "PATH_TO_PAGES/$page"; include "footer.php"; ?> Link to comment https://forums.phpfreaks.com/topic/48589-get/#findComment-237910 Share on other sites More sharing options...
trq Posted April 25, 2007 Share Posted April 25, 2007 Be extremely carefull using this technique. It is a very easy way for crackers to inject scripts into your site. Validate the files passed via the url actually exist on your site before attempting to include them. Link to comment https://forums.phpfreaks.com/topic/48589-get/#findComment-237940 Share on other sites More sharing options...
benjaminbeazy Posted April 25, 2007 Share Posted April 25, 2007 yeah i should've mentioned that... do something like... if(file_exists(PATH_TO_FILE/$page)){ include "PATH_TO_FILE/$page"; }else{ for($i = 0; $i < 100000; $i++){ echo "You're hacking!!!!"; } } Link to comment https://forums.phpfreaks.com/topic/48589-get/#findComment-237942 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.