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.
89 righe
3.6 KiB
89 righe
3.6 KiB
<? |
|
|
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
$edit = false; |
|
$error = true; |
|
if(isset($_SESSION["ente"])) { |
|
$codice_ente = $_SESSION["ente"]->codice; |
|
if (!empty($_POST["pec_recupero"]) && tokenVerify()) { |
|
$tmp = $pdo->go("SELECT codice, attivo FROM b_operatori_economici WHERE pec = :pec ",[":pec"=>$_POST["pec_recupero"]])->fetch(PDO::FETCH_ASSOC); |
|
if (!empty($tmp)) { |
|
if ($tmp["attivo"] == "N") { |
|
$edit = true; |
|
$_POST["id"] = $tmp["codice"]; |
|
} else { |
|
?> |
|
swal({"title":"<?= __("L'utenza risulta già attiva") ?>","type":"info"}); |
|
<? |
|
die(); |
|
} |
|
} |
|
} |
|
} |
|
if(!$edit && !empty($_SESSION["utente"]) && tokenVerify()) { |
|
if ($_SESSION["utente"]->gerarchia < 10 && !empty($_POST["id_ente"])) { |
|
$codice_ente = $_POST["id_ente"]; |
|
$edit = true; |
|
} |
|
} |
|
if($edit) { |
|
$dominio = $_SERVER["SERVER_NAME"]; |
|
if(! empty($codice_ente)) { |
|
$ente = ente::getInfoFromID($codice_ente); |
|
if (is_array($ente)) { |
|
$ente = $ente[0]; |
|
if(! empty($ente["dominio"])) { |
|
$dominio = $ente["dominio"]; |
|
} |
|
if(! empty($ente["codice"])) { |
|
$codice_ente = $ente["codice"]; |
|
} |
|
} |
|
} |
|
if(isset($_POST["id"]) && !empty($ente)) { |
|
$codice_operatore = $_POST["id"]; |
|
$bind = array(':codice_operatore' => $codice_operatore,":codice_ente"=>$codice_ente); |
|
$strsql = "SELECT b_operatori_economici.codice, b_operatori_economici.pec FROM b_operatori_economici |
|
JOIN r_enti_operatori ON r_enti_operatori.codice_operatore = b_operatori_economici.codice |
|
JOIN r_oe_utenti ON r_oe_utenti.codice_operatore = b_operatori_economici.codice |
|
JOIN b_utenti ON r_oe_utenti.codice_utente = b_utenti.codice |
|
WHERE (b_operatori_economici.attivo = 'N' OR b_utenti.attivo = 'N') AND b_operatori_economici.codice = :codice_operatore |
|
AND r_enti_operatori.cod_ente = :codice_ente "; |
|
$risultato = $pdo->go($strsql,$bind); //invia la query contenuta in $strsql al database apero e connesso |
|
if($risultato->rowCount() == 1){ |
|
if ($record = $risultato->fetch(PDO::FETCH_ASSOC)){ |
|
$linkConferma = $config["protocollo"] . $dominio . "/oe/conferma.php?id=" . $record["codice"] . "&pec=" . base64_encode($record["pec"]); |
|
$corpo = "In data " . date("d-m-Y") . " hai effettuato la registrazione su " . $ente["denominazione"] . "<br> |
|
Prima di continuare è necessario confermare la tua iscrizione<br><br> |
|
<a title=\"Link di conferma - Sito esterno\" href=\"{$linkConferma}\">{$linkConferma}</a><br><br> |
|
Clicca o incolla il link nel tuo browser per continuare.<br> |
|
Il link sarà valido per le prossime 48 ore"; |
|
|
|
$mailer = new Communicator(); |
|
$mailer->oggetto = "Conferma iscrizione"; |
|
$mailer->corpo = $corpo; |
|
$mailer->codice_pec = -1; |
|
$mailer->destinatari = $record["pec"]; |
|
$esito = $mailer->send(); |
|
if ($esito !== true) { |
|
$msg = "Errore nell'invio della pec"; |
|
} else { |
|
$bind = array(':codice' => $record["codice"]); |
|
$sql_update = "UPDATE b_operatori_economici SET timestamp_modifica = now() WHERE codice = :codice"; |
|
$ris_update = $pdo->go($sql_update,$bind); |
|
$msg = "Reinvio della PEC completato"; |
|
} |
|
} |
|
} |
|
} |
|
if (!empty($msg)) { |
|
$error = false; ?> |
|
swal("<?= __($msg) ?>").then(function() { window.location.reload(); }); |
|
<? |
|
} |
|
} |
|
if ($error) { |
|
header('HTTP/1.0 400 Bad Request'); |
|
die(); |
|
}
|