Answer the question
In order to leave comments, you need to log in
Do I need to filter data file_exists(), file_get_contents()?
there is a diagram like this:
$file = (isset($_GET['file']) && !empty($_GET['file']) ? $_GET['file'] : false);
if ($file) {
if (file_exists($file)) $file = file_get_contents($file);
}
Answer the question
In order to leave comments, you need to log in
Of course, this is a classic mistake - you are actually letting the user read an arbitrary file on your server. This is a huge security hole.
Stepic.org has a course on web project security and it has a chapter on exactly this issue.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question