3v4l.org

run code in 300+ PHP versions simultaneously
<?php $allowed = array('txt', 'docx'); print "\n\$_REQUEST:"; var_dump($_REQUEST); //o$a="txt.$php"; //echo "test${a}test\n"; $zzfile = $_REQUEST['zzfile']; //$filename = basename($zzfile); $filename = $zzfile; print "\nfilename:\n"; var_dump($filename); if (preg_match('#\.(.+)$#', $filename, $matches) && isset($matches[1]) && !in_array($matches[1], $allowed)) die("Extension ${matches[1]} is not allowed!"); echo "\nmatches:"; var_dump($matches); preg_match('#.#', $filename, $met); print("\nmet:\n"); var_dump($met); if (strrpos($filename, '.') !== false) //zwraca od pierwszej kropki od prawej do konca + end $ext = substr($filename, strrpos($filename, '.')); else $ext = ''; $newfile = "flag$ext"; echo "Reading <strong>$newfile</strong>..."; // Hint: the flag is in flag.php echo '<pre>'; readfile($newfile); echo '</pre>'; ?>

preferences:
43.42 ms | 402 KiB | 5 Q