I'm not sure if this is a valid way how to filter LFI, because if you bypass in_array
function you can include any file, for example /etc/passwd
.
Is it possible to bypass in_array
function?
<?php
$file = $_GET['file'];
$files = array("some", "files", "here");
if (in_array($file, $files, true)) {
include('directory/' . $file);
echo "In array \n";
} else {
echo "Not in array \n";
}
?>