I have two large files that I want to make available for users to download. When trying to download from my web host, the download never starts and I get a “504 Gateway Timeout”. How would I revise my code to download from a file sharing site? I tried the following code but get a “This page isn’t workingfoxclone is currently unable to handle this request.”
Appreciate any help you can provide.
<?php
function mydloader($l_filename=NULL) {
$php_scripts = '../../php/';
require $php_scripts . 'PDO_Connection_Select.php';
require $php_scripts . 'GetUserIpAddr.php';
if( isset( $l_filename ) ) {
if substr($l_filename, 0, 10)=='foxclone_s' {
$url_path = 'https://www.mediafire.com/file/tyqr4tzthiftuy1/foxclone_std-50-06.iso/file' }
elseif substr($l_filename, 0, 10)=='foxclone_e' {
$url_path = 'https://www.mediafire.com/file/xnovs5ltdj2z5wr/foxclone_edge-50-07.iso/file' }
else
header('Content-Type: application/octet-stream');
header("Content-Transfer-Encoding: Binary");
header("Content-disposition: attachment");
header('Pragma: no-cache');
header('Expires: 0');
readfile($l_filename);
}
$ip = GetUserIpAddr();
if (!$pdo = PDOConnect("foxclone_data"))
{ echo "unable to connect";
exit;
}
$test = $pdo->query("SELECT lookup.id FROM lookup WHERE inet_aton('$ip') >= lookup.ipstart AND inet_aton('$ip') <= lookup.ipend");
$ref = $test->fetchColumn();
$ref = intval($ref);
$ext = pathinfo($l_filename, PATHINFO_EXTENSION);
$stmt = $pdo->prepare("INSERT INTO download (address, filename, ip_address, lookup_id) VALUES (?, ?, inet_aton('$ip'), ?)");
$stmt->execute([$ip, $ext, $ref ]) ;
}
else {
echo "isset failed";
}
}
mydloader($_GET["f"]);
exit;