Code: Select all
<?php
$php_scripts = '../../php/';
require $php_scripts . 'PDO_Connection_Select.php';
require $php_scripts . 'GetUserIpAddr.php';
function mydloader($l_filename= "")
{
$ip = GetUserIpAddr();
if (!$pdo = PDOConnect("foxclone_data"))
{
exit;
}
{
$file = $l_filename;
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.basename($file).'"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($file)); /*Read the size of the file*/
readfile($file);
exit;
}
}
/*Clear system output buffer*/
flush();
mydloader($_GET["f"]);
exit;<a href="https://i.imgur.com/2SqiLu4.png" title="source: imgur.com" /></a>
NOTE: For security, the code will eventually be modified to pass a number to this script and do a lookup in the database to get a filename rather than passing the filename directly.