define("user", "filedl");
define("pw", "dme)2n7IKkdn");
$known = array(192, 193, 194, 245, 276);
if(isset($_GET["i"]) && is_numeric($_GET["i"]) && in_array($_GET["i"],$known))
$id = $_GET["i"];
else die('ungültiger Parameter!');
try{
$dbc = new PDO('mysql:host=localhost;dbname=cnd', user, pw);
} catch(PDOException $e){
echo '
'.$e.'
';
die();
}
$stmt = $dbc->prepare(' SELECT url
FROM downloads
WHERE id = ?
ORDER BY id
LIMIT 1');
$stmt->execute(array($id));
$dl = $stmt->fetchColumn();
$url_parts = explode('/', $dl);
Header( "Content-Type: application/octet-stream" );
Header( 'Content-Disposition: attachment; filename="'.$url_parts[count($url_parts)-1].'"' );
readfile($dl);
$dbc = null;
?>