Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
55 righe
2.4 KiB
55 righe
2.4 KiB
<? |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
$content = false; |
|
if (empty($_POST["codice_concorso"]) && !empty($_GET["codice_concorso"])) $_POST = $_GET; |
|
if (!empty($_SESSION["utente"]) && !empty($_POST["tipo"]) && !empty($_POST["codice_lotto"]) && tokenVerify($_POST["token"])) { |
|
$codice_round = $_POST["codice_round"] ?? NULL; |
|
$concorso = publicConcorso::init($_POST["codice_concorso"],$codice_round); |
|
if (!empty($concorso)) { |
|
if ($concorso->setLotto($_POST["codice_lotto"])) { |
|
$partecipante = $concorso->miaPartecipazione(); |
|
if (!empty($partecipante)) { |
|
$sql = "SELECT codice FROM b_offerte_concorsi WHERE codice_partecipante = :codice_partecipante AND b_offerte_concorsi.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_concorsi WHERE codice = :codice "; |
|
$ris = $pdo->go($sql,array(":codice"=>$offer["codice"])); |
|
$offer = $ris->fetch(PDO::FETCH_ASSOC); |
|
if (!empty($_SESSION["concorsioffers"][$partecipante["codice"]][$_POST["tipo"]])) { |
|
$salt = $_SESSION["concorsioffers"][$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["concorsioffers"][$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(); |
|
} |
|
} |
|
?>
|