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.
48 righe
1.7 KiB
48 righe
1.7 KiB
<? |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
$error = true; |
|
if (!empty($_POST) && !empty($_SESSION["utente"]) && $_SESSION["utente"]->canCertify($_POST["codice"]) && tokenVerify()) { |
|
$bind = array(); |
|
$bind[":codice"] = $_POST["codice"]; |
|
$sql = "SELECT b_utenti.* FROM b_utenti WHERE b_utenti.codice = :codice AND certificato = 'N'"; |
|
$ris_utenti = $pdo->go($sql,$bind); |
|
if (isset($ris_utenti) && $ris_utenti->rowCount() === 1) { |
|
$salva = new salva(); |
|
$salva->debug = false; |
|
|
|
$salva->nome_tabella = "b_utenti"; |
|
$salva->operazione = "UPDATE"; |
|
$salva->oggetto = [ |
|
"codice" => $_POST["codice"], |
|
"certificato" => "S", |
|
"timestamp_certificazione" => date("d/m/Y H:i:s"), |
|
"utente_certificante" => $_SESSION["utente"]->codice |
|
]; |
|
$codice = $salva->save(); |
|
if (!empty($codice)) { |
|
$error = false; |
|
if (isset($_POST["allegato"])) { |
|
foreach($_POST["allegato"] as $allegato) { |
|
if (filesManager::saveFile($allegato["filename"],$codice,"utenti-certificazione",$allegato["nome"] ?? "","A",$allegato["classificazione"] ?? "") === false) { |
|
$errori_upload[] = $allegato["filename"]; |
|
} |
|
} |
|
} |
|
?> |
|
swal({title:js_dict["success-msg"],type:"success"}).then(function() { |
|
window.location.reload(); |
|
}); |
|
<? |
|
} else { |
|
?> |
|
swal({title:js_dict.error,html:js_dict["error-generic"] + "<br>Error: # 1",type:"error"}); |
|
<? |
|
} |
|
} |
|
} |
|
if ($error) { |
|
header('HTTP/1.0 403 Forbidden'); |
|
die(); |
|
} |
|
?>
|
|
|