When I use the following PHP code:
$id = $_GET['page']; $page = include ($id.'.php'); echo $page;
The code within the $id.php file is returned, however there is a “1” appended to it, any idea why this is happening?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
include()will return boolean TRUE if the file was successfully included. You then echo out that true value, which is printed as a1.Of note: never directly use user-provided data ($_GET[‘page’]) in file system operations. It’s a hideious security risk. You’ve at least got
.phpbeing appended so it’s not quite as large a gaping hole, but still… don’t do this.