session_start();
function startsWith($haystack, $needle)
{
$length = strlen($needle);
return (substr($haystack, 0, $length) === $needle);
}
if (isset($_REQUEST["file"])){
$file = $_REQUEST["file"];
if( ( startsWith($file,"upload") || startsWith($file,"problems")) && !strpos($file,"..") ) {
$role = $_REQUEST["role"];
//$file=$dir;
if(is_file($file) )
{
header("Content-type: application/force-download");
header("Content-Transfer-Encoding: Binary");
header("Content-length: ".filesize($file));
header("Content-disposition: attachment; filename=\"".basename($file)."\"");
readfile("$file");
}else
{
echo $dir;
?>