PHP
Challenge
Solution
$file = isset($_GET['file']) ? str_replace('../', '', $_GET['file']) : null;
if (isset($file) && !empty($file)) {
try {
if (!file_exists("./$file")) throw new Exception("File not found.");
$content = @file_get_contents("./$file");
if ($content === false) throw new Exception("Failed to read the file.");
echo $content;

Mis à jour