hisoka Posted April 18, 2016 Share Posted April 18, 2016 in this code : <?php $file = $_GET['page']; if(isset($page)) { include("pages/$page"); } else { include("index.php"); } ?> I do not get what does the thing in red mean : include("pages/$page"); two files one is a variable and the other is not ?? Link to comment Share on other sites More sharing options...
Ingolme Posted April 18, 2016 Share Posted April 18, 2016 pages/ is the name of a folder. $page is a variable that contains a file name that should be inside that folder. Have you read the PHP manual page about strings yet? http://php.net/strings That code is dangerous because it grants the user the ability to view or execute any file they want on your filesystem. 1 Link to comment Share on other sites More sharing options...
hisoka Posted April 18, 2016 Author Share Posted April 18, 2016 Yes read it from top to bottom but I understood some and some I did not understand at all Thank you very much I understood you explanation very well . Now I am not confused about that code Link to comment Share on other sites More sharing options...
thescientist Posted April 19, 2016 Share Posted April 19, 2016 the code itself looks incorrectly written. isset is being used against $page, but the variable assigned to $_GET['page'] is $file, and then this undefined $page variable is being used in the include. Link to comment Share on other sites More sharing options...
hisoka Posted April 26, 2016 Author Share Posted April 26, 2016 I did not want to know about that code in its whole but only about the meaning of pages/$page and the explanation of Foxy Mod was perfect . Thank you to let me know that the code is incorrectly written Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now