Revision: 61909
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 23, 2013 22:14 by federicoq
Initial Code
<?php isGyu(); MethodStandard(); Right('*'); $informazioni = CallFunction('mediateca', 'get', $_GET["id"]); $prodotto = $informazioni->getAttr('prodotto'); // L'utente, ha acquistato questo prodotto? $carrelliValidi = CallFunction('acquisti', 'list'); foreach($carrelliValidi as $v) if($v->getAttr('stato') >= 4) $validCart[] = "carrelloId = '" . FetchObject(Database()->query("SELECT * FROM `carrelli` WHERE acquistoId = '".$v->getAttr('id')."' LIMIT 1"), 0)->getAttr('id')."'"; $q = "SELECT * FROM `carrelliItem` WHERE prodottoId = '".$informazioni->getAttr('prodotto')."' AND (" . implode(' OR ', $validCart) . ") LIMIT 1"; $informazioni_2 = FetchObject(Database()->query($q), 0); if(is_object($informazioni_2)) { $filename = upload . $informazioni->getAttr('contenuto'); $porzioni = explode(".", basename($filename)); $ext = $porzioni[count($porzioni) - 1]; header("Pragma: public"); header("Expires: 0"); // set expiration time header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); // browser must download file from server instead of cache // force download dialog header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); // use the Content-Disposition header to supply a recommended filename and // force the browser to display the save dialog. header("Content-Disposition: attachment; filename=".$informazioni->getAttr('nome') . "." . $ext .";"); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize($filename)); @readfile($filename); } ?>
Initial URL
Initial Description
test
Initial Title
Force Download — Gyural
Initial Tags
Initial Language
PHP