setLotto($_POST["codice_lotto"])) { $partecipante = $gara->miaPartecipazione(); if (!empty($partecipante)) { $sql = "SELECT codice FROM b_offerte_gare WHERE codice_partecipante = :codice_partecipante AND b_offerte_gare.tipo = :tipo "; $ris = $pdo->go($sql,array(":codice_partecipante"=>$partecipante["codice"],":tipo"=>$_POST["tipo"])); if ($ris->rowCount()>0) { $offer = $ris->fetch(PDO::FETCH_ASSOC); $sql = "SELECT * FROM b_offerte_gare WHERE codice = :codice "; $ris = $pdo->go($sql,array(":codice"=>$offer["codice"])); $offer = $ris->fetch(PDO::FETCH_ASSOC); if (!empty($_SESSION["gareoffers"][$partecipante["codice"]][$_POST["tipo"]])) { $salt = $_SESSION["gareoffers"][$partecipante["codice"]][$_POST["tipo"]]; } else if (!empty($offer["content"])) { $content = base64_decode($offer["content"]); } else if (!empty($_POST["salt"])) { $salt = $_POST["salt"]; } if (isset($salt)) { $content = openssl_decrypt($offer["cryptedContent"],"AES128",$salt,OPENSSL_RAW_DATA,$config["simple_encrypt"]["offer"]); } } } } } if ($content !== false) { if (!empty($_POST["salt"])) { $_SESSION["gareoffers"][$partecipante["codice"]][$_POST["tipo"]] = $_POST["salt"]; } if (!isset($unitTestExecution)) { header('Content-Type: application/pdf'); header('Content-Disposition: attachment; filename='.str_replace(" ","-",__("Offerta {$_POST["tipo"]}")).'.pdf'); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); echo $content; } else { file_put_contents($pathFileOfferta,$content); } } else { header('HTTP/1.0 403 Forbidden'); echo __("Errore nella richiesta"); die(); } } ?>