Sindbad~EG File Manager
<?php
// This page enables the user to download one of 8 versions of MathXpert.
// For it to work, session variables 'OK', 'WhichDisk', 'ProductType', and 'TimeLimit' must be correctly set.
// In particular for a paid version, these are set only when we're sure that they have paid.
session_start();
$WhichDisk = $_SESSION['WhichDisk'];
$ProductType = $_SESSION['ProductType'];
$OK = $_SESSION['OK'];
if($OK != "ok" ||
($ProductType != "paid" && $ProductType != "lab" && $ProductType != "WebGradesLabEdition" && $ProductType != "WebGradesCalculus4" && $ProductType != "trial" && $ProductType != "Prepaid") ||
($WhichDisk != "0" && $WhichDisk != "1" && $WhichDisk != "3" && $WhichDisk != "7")
)
{ header("Location: ./index.php");
// redirect to main web page
}
$oops = "oops"; // so it won't be "" unless something goes wrong
$Dir= "Calculus4/";
/*________________________________________________________*/
function send_download($directory, $filename)
{
$file_path = '../PrivateFiles/'.$directory.$filename;
$file_size=@filesize($file_path);
header("Content-Type: application/x-msdownload"); // that's the mime type for a .exe file
header("Content-disposition: attachment; filename=$filename");
header("Content-Length: $file_size");
header('Content-Transfer-Encoding: binary');
readfile($file_path);
exit;
}
/*____________________________________________________________________*/
if(!isset($_SESSION["countDownloads"]))
$_SESSION["countDownloads"] = 1;
else
++$_SESSION["countDownloads"];
if($_SESSION["countDownloads"] <= 15
//&& ( $_SESSION['OS'] == "Win32" || $_SESSION['OS'] == "Win64" || $_SESSION['OS'] == "Mac")
)
send_download($Dir, "setup.exe"); // must be done before headers are issued
else
$oops = $Dir;
/*________________________________________________________*/
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
For security reasons, no more than three downloads are allowed per day per person. You have had three attempts today already.
<?php
// echo '\N../PrivateFiles/' .$Dir . "setup.exe";
// echo $_SESSION['WhichDisk']; echo "\n"; echo $_SESSION['TimeLimit'];s
if($oops != "")
{ echo "Download directory incorrectly set\n";
}
?>
</body>
</html>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists