gestione gare pubbliche
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.3 KiB

<?
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php";
include_once($configPath);
$content = false;
if (empty($_POST["codice_gara"]) && !empty($_GET["codice_gara"])) $_POST = $_GET;
if (!empty($_SESSION["utente"]) && !empty($_POST["tipo"]) && !empty($_POST["codice_lotto"]) && tokenVerify($_POST["token"])) {
$codice_round = $_POST["codice_round"] ?? NULL;
$gara = publicGara::init($_POST["codice_gara"],$codice_round);
if (!empty($gara)) {
if ($gara->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();
}
}
?>