headerData["downloadId"])){ if(ereg("[0-9]",$download->headerData["downloadId"])){ $getDownload = $download->db->select("SELECT * FROM attachments WHERE attachment_id = '".$download->headerData["downloadId"]."'"); if(count($getDownload) === 1){ if($getDownload[0]['public'] != 1){ if($download->login === true){ //toegang tot download } else{ header("Location: ".BASEURL."login"); exit; } } $download->db->update("UPDATE attachments SET downloads = downloads+1 WHERE attachment_id = '".$download->headerData["downloadId"]."'"); $download->db->close(); if(file_exists(ROOTDIR."/attachments/".$getDownload[0]['internal_name'])){ $fsize = filesize(ROOTDIR."/attachments/".$getDownload[0]['internal_name']); header('Pragma: public'); header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1 header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1 header('Content-Transfer-Encoding: none'); header('Content-Type: application/octetstream; name="' . $getDownload[0]['filename'] . '\'"'); //This should work for IE & Opera header('Content-Type: application/octet-stream; name="' . $getDownload[0]['filename'] . '\'"'); //This should work for the rest header("Content-Type: application/force-download"); header('Content-Disposition: attachment; filename="' . $getDownload[0]['filename'] . '"'); header("Content-Length: ".$fsize); readfile(ROOTDIR."/attachments/".$getDownload[0]['internal_name']); exit; } } } } echo "Problemen met downloaden van het bestand."; ?>