Changeset a1f2a9f
- Timestamp:
- Dec 5, 2025, 11:11:32 PM (2 days ago)
- Branches:
- main
- Children:
- b8095d1
- Parents:
- 65575a8
- Location:
- admin
- Files:
-
- 8 edited
-
modules/contenuto.php (modified) (1 diff)
-
modules/elenco_consultazioni.php (modified) (1 diff)
-
modules/elenco_utenti.php (modified) (1 diff)
-
modules/gestione_consultazioni.php (modified) (3 diffs)
-
modules/gestione_utenti.php (modified) (6 diffs)
-
modules/salva_consultazione.php (modified) (3 diffs)
-
modules/salva_utente.php (modified) (4 diffs)
-
principale.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
admin/modules/contenuto.php
r65575a8 ra1f2a9f 70 70 $op = $defaultPage; 71 71 } 72 echo "<img src=\"../logo.jpg\" alt=\"\" />";72 #echo "<img src=\"../logo.jpg\" alt=\"\" />"; 73 73 // Includo la pagina corrispondente 74 74 include($pagesMap[$op]); -
admin/modules/elenco_consultazioni.php
r65575a8 ra1f2a9f 11 11 echo "<tr id=\"riga$key\"><td style=\"display:none;\" id=\"link_trasparenza$key\" name=\"link_trasparenza$key\">".$val['link_trasparenza']."</td><td style=\"display:none;\" id=\"id_cons_gen$key\" name=\"id_cons_gen$key\">".$val['id_cons_gen']."</td><td style=\"display:none;\" id=\"tipo_cons$key\" name=\"tipo_cons$key\">".$val['tipo_cons']."</td><td style=\"display:none;\" id=\"chiusa$key\" name=\"chiusa$key\">".$val['chiusa']."</td><td style=\"display:none;\" id=\"id_conf$key\" name=\"id_conf$key\">".$val['id_conf']."</td><td style=\"display:none;\" id=\"preferita$key\" name=\"preferita$key\">".$pref."</td><td style=\"display:none;\" id=\"preferenze$key\" name=\"preferenze$key\">".$val['preferenze']."</td><td style=\"display:none;\" id=\"id_fascia$key\" name=\"id_fascia$key\">".$val['id_fascia']."</td><td style=\"display:none;\" id=\"vismf$key\" name=\"vismf$key\">".$val['vismf']."</td><td style=\"display:none;\" id=\"solo_gruppo$key\" name=\"solo_gruppo$key\">".$val['solo_gruppo']."</td><td style=\"display:none;\" id=\"disgiunto$key\" name=\"disgiunto$key\">".$val['disgiunto']."</td><td style=\"display:none;\" id=\"proiezione$key\" name=\"proiezione$key\">".$val['proiezione']."</td><td>"; 12 12 if($val['preferita']) echo "*"; 13 echo "</td><td id=\"descrizione$key\">".$val['descrizione']."</td><td id=\"data_inizio$key\">".$val['data_inizio']."</td><td id=\"data_fine$key\">".$val['data_fine']."</td><td><button type=\"button\" class=\"btn btn-sm btn-warning me-1\" onclick=\"editConsultazione($key)\">Modifica</button><button type=\"button\" class=\"btn btn-danger btn-sm\" onclick=\" rimuoviConsultazione($key)\">Elimina</button></td></tr>";13 echo "</td><td id=\"descrizione$key\">".$val['descrizione']."</td><td id=\"data_inizio$key\">".$val['data_inizio']."</td><td id=\"data_fine$key\">".$val['data_fine']."</td><td><button type=\"button\" class=\"btn btn-sm btn-warning me-1\" onclick=\"editConsultazione($key)\">Modifica</button><button type=\"button\" class=\"btn btn-danger btn-sm\" onclick=\"deleteConsultazione($key)\">Elimina</button></td></tr>"; 14 14 } 15 15 -
admin/modules/elenco_utenti.php
r65575a8 ra1f2a9f 4 4 else 5 5 require_once '../includes/check_access.php'; 6 6 global $currentUserRole; 7 7 $row=elenco_utenti(); 8 8 # ciclo ancora da adattare 9 9 foreach($row as $key=>$val){ 10 10 $key++; 11 echo "<tr id=\"riga$key\"><td id=\"username$key\">".$val['aid']."</td><td style=\"display:none;\" id=\"password$key\">".$val['pwd']."</td><td id=\"email$key\">".$val['email']."</td><td id=\"nominativo$key\">".$val['name']."</td><td><button class=\"btn btn-sm btn-warning me-1\" onclick=\"editUser($key)\">Modifica $key</button>";11 echo "<tr id=\"riga$key\"><td id=\"username$key\">".$val['aid']."</td><td style=\"display:none;\" id=\"password$key\">".$val['pwd']."</td><td id=\"email$key\">".$val['email']."</td><td id=\"nominativo$key\">".$val['name']."</td><td><button class=\"btn btn-sm btn-warning me-1\" onclick=\"editUser($key)\">Modifica</button>"; 12 12 if($currentUserRole != 'operatore' and $val['adminsuper']!=1 and $val['admincomune']!='1') echo "<button class=\"btn btn-sm btn-danger\" onclick=\"deleteUser($key)\">Elimina</button>"; echo"</td></tr>"; 13 13 } #die("TEST: --- ".count($row)); -
admin/modules/gestione_consultazioni.php
r65575a8 ra1f2a9f 173 173 const linkDait = document.getElementById ( "link" ).value 174 174 const tipo = document.getElementById ( "tipo" ).value 175 const preferita = document.getElementById ( "preferita" ). value175 const preferita = document.getElementById ( "preferita" ).checked 176 176 const id_cons_gen = document.getElementById ( "id_cons_gen" ).value 177 177 const chiusa = document.getElementById ( "chiusa" ).value … … 217 217 218 218 }) 219 .catch(error => {220 console.error('Errore durante l\'upload:', error);221 risultato.innerHTML = 'Si è verificato un errore durante l\'upload.';222 });223 219 }; 224 220 225 221 226 222 function deleteConsultazione(index) { 223 if (confirm("Confermi l'eliminazione?") == true) { 227 224 var id_cons_gen = document.getElementById ( "id_cons_gen"+index ).innerText 228 225 var xmlhttp = new XMLHttpRequest(); … … 234 231 xmlhttp.open("GET","../principale.php?funzione=salvaConsultazione&id_cons_gen="+id_cons_gen+"&op=cancella",true); 235 232 xmlhttp.send(); 236 233 } 237 234 // document.getElementById("riga"+index).style.display = 'none' 238 235 } 236 239 237 function editConsultazione(index) { 240 238 document.getElementById ( "id_cons_gen" ).value = document.getElementById ( "id_cons_gen"+index ).innerText -
admin/modules/gestione_utenti.php
r65575a8 ra1f2a9f 1 1 <?php 2 2 require_once '../includes/check_access.php'; 3 4 $currentUserRole = $_SESSION['ruolo'] ?? 'operatore';5 $row=elenco_utenti();6 foreach($row as $val)7 // Dati fittizi sedi e sezioni8 $sedi = [9 'Scuola A' => range(1, 4),10 'Scuola B' => range(5, 6),11 'Scuola C' => range(7, 9),12 'Scuola D' => range(10, 11),13 'Scuola E' => range(12, 13)14 ];15 16 $users = [17 ['id'=>1, 'username'=>'admin1', 'email'=>'admin1@example.com', 'role'=>'admin'],18 ['id'=>2, 'username'=>'operatore1', 'email'=>'op1@example.com', 'role'=>'operatore'],19 ['id'=>3, 'username'=>'pres1', 'email'=>'pres1@example.com', 'role'=>'operatore presidente', 'nome'=>'Mario', 'cognome'=>'Rossi', 'telefono'=>'3331112222', 'sede'=>'Scuola A', 'sezione'=>'1', 'stato'=>'attivo'],20 ['id'=>4, 'username'=>'pres2', 'email'=>'pres2@example.com', 'role'=>'operatore presidente', 'nome'=>'Luca', 'cognome'=>'Bianchi', 'telefono'=>'3332223333', 'sede'=>'Scuola B', 'sezione'=>'5', 'stato'=>'disattivo'],21 ['id'=>5, 'username'=>'super1', 'email'=>'super@example.com', 'role'=>'superuser'],22 ['id'=>6, 'username'=>'pres3', 'email'=>'pres3@example.com', 'role'=>'operatore presidente', 'nome'=>'Elena', 'cognome'=>'Verdi', 'telefono'=>'3334445555', 'sede'=>'Scuola C', 'sezione'=>'7', 'stato'=>'attivo'],23 ['id'=>7, 'username'=>'admin2', 'email'=>'admin2@example.com', 'role'=>'admin'],24 ['id'=>8, 'username'=>'pres4', 'email'=>'pres4@example.com', 'role'=>'operatore presidente', 'nome'=>'Marco', 'cognome'=>'Blu', 'telefono'=>'3339998888', 'sede'=>'Scuola D', 'sezione'=>'10', 'stato'=>'attivo'],25 ];26 27 /*28 if ($_SERVER['REQUEST_METHOD'] === 'POST' && empty($_POST['user_id'])) {29 // Connessione al database30 require_once '../includes/db.php'; // o modifica con il tuo file di connessione31 32 $username = $_POST['username'];33 $password = password_hash($_POST['password'], PASSWORD_DEFAULT);34 $email = $_POST['email'];35 $role = $_POST['role'];36 37 $stmt = $conn->prepare("INSERT INTO utenti (username, password, email, ruolo) VALUES (?, ?, ?, ?)");38 $stmt->bind_param("ssss", $username, $password, $email, $role);39 $stmt->execute();40 $last_id = $stmt->insert_id;41 42 // Se ruolo è operatore presidente, inserisci i dati extra43 if ($role === 'operatore presidente') {44 $nome = $_POST['nome'];45 $cognome = $_POST['cognome'];46 $telefono = $_POST['telefono'];47 $sede = $_POST['sede'];48 $sezione = $_POST['sezione'];49 $stato = $_POST['stato'];50 51 $stmt2 = $conn->prepare("UPDATE utenti SET nome=?, cognome=?, telefono=?, sede=?, sezione=?, stato=? WHERE id=?");52 $stmt2->bind_param("ssssssi", $nome, $cognome, $telefono, $sede, $sezione, $stato, $last_id);53 $stmt2->execute();54 }55 }56 */57 /*58 if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_POST['user_id'])) {59 require_once '../includes/db.php';60 61 $id = intval($_POST['user_id']);62 $username = $_POST['username'];63 $email = $_POST['email'];64 $role = $_POST['role'];65 66 // Password facoltativa (solo se viene aggiornata)67 if (!empty($_POST['password'])) {68 $password = password_hash($_POST['password'], PASSWORD_DEFAULT);69 $stmt = $conn->prepare("UPDATE utenti SET username=?, email=?, ruolo=?, password=? WHERE id=?");70 $stmt->bind_param("ssssi", $username, $email, $role, $password, $id);71 } else {72 $stmt = $conn->prepare("UPDATE utenti SET username=?, email=?, ruolo=? WHERE id=?");73 $stmt->bind_param("sssi", $username, $email, $role, $id);74 }75 $stmt->execute();76 77 if ($role === 'operatore presidente') {78 $nome = $_POST['nome'];79 $cognome = $_POST['cognome'];80 $telefono = $_POST['telefono'];81 $sede = $_POST['sede'];82 $sezione = $_POST['sezione'];83 $stato = $_POST['stato'];84 85 $stmt2 = $conn->prepare("UPDATE utenti SET nome=?, cognome=?, telefono=?, sede=?, sezione=?, stato=? WHERE id=?");86 $stmt2->bind_param("ssssssi", $nome, $cognome, $telefono, $sede, $sezione, $stato, $id);87 $stmt2->execute();88 }89 }90 */91 /*92 if ($_SERVER['REQUEST_METHOD'] === 'GET' && isset($_GET['delete_user'])) {93 require_once '../includes/db.php';94 95 $id = intval($_GET['delete_user']);96 97 $stmt = $conn->prepare("DELETE FROM utenti WHERE id = ?");98 $stmt->bind_param("i", $id);99 $stmt->execute();100 }101 */102 103 3 ?> 104 105 4 <!-- CONTENUTO HTML --> 106 5 <section class="content"> … … 114 13 </div> 115 14 <div class="card-body"> 116 <form id="userForm" >15 <form id="userForm" onsubmit="aggiungiUser(event)"> 117 16 <div class="form-row"> 118 17 <div class="form-group col-md-3"> … … 135 34 136 35 137 <button type="button" class="btn btn-success" id="saveBtn">Aggiungi Utente</button>138 <button type="button" class="btn btn-secondary" id="cancelEdit">Annulla</button>36 <button type="submit" class="btn btn-success" id="submitBtn">Aggiungi Utente</button> 37 <button type="reset" class="btn btn-secondary" id="cancelEdit">Annulla</button> 139 38 </form> 140 39 </div> … … 156 55 </tr> 157 56 </thead> 158 <tbody id=" userRows"><?php include('elenco_utenti.php'); ?></tbody>57 <tbody id="risultato"><?php include('elenco_utenti.php'); ?></tbody> 159 58 </table> 160 59 </div> … … 164 63 165 64 function editUser(id) { 166 const u = users.find(u => u.id === id);167 if (!u) return;168 65 document.getElementById('username').value = document.getElementById('username'+id).innerText; 169 document.getElementById('password').value = ' ';66 document.getElementById('password').value = '********'; 170 67 document.getElementById('email').value = document.getElementById('email'+id).innerText; 171 68 document.getElementById('nominativo').value = document.getElementById('nominativo'+id).innerText;; 172 document.getElementById ( "s aveBtn" ).textContent = "Salva modifiche";69 document.getElementById ( "submitBtn" ).textContent = "Salva modifiche"; 173 70 174 71 } … … 199 96 .then(response => response.text()) // O .json() se il server risponde con JSON 200 97 .then(data => { 98 const myForm = document.getElementById('userForm'); 201 99 risultato.innerHTML = data; // Mostra la risposta del server 202 document.getElementById ( "saveBtn" ).textContent = "Aggiungi Utente"; 203 document.getElementById ( "username" ).value = ''; 204 document.getElementById ( "password" ).value = ""; 205 document.getElementById ( "email" ).value = ''; 206 document.getElementById ( "nominativo" ).value = ''; 100 myForm.reset(); 101 document.getElementById ( "submitBtn" ).textContent = "Aggiungi Utente" 102 207 103 }) 208 .catch(error => {209 console.error('Errore durante l\'upload:', error);210 risultato.innerHTML = 'Si è verificato un errore durante l\'upload.';211 });212 104 }; 213 105 214 function deleteUtente(index) { 215 var username = document.getElementById ( "username"+index ).innerText 216 var xmlhttp = new XMLHttpRequest(); 217 xmlhttp.onreadystatechange = function() { 218 if (this.readyState == 4 && this.status == 200) { 219 document.getElementById("risultato").innerHTML = this.responseText; 106 function deleteUser(index) { 107 if (confirm("Confermi l'eliminazione?") == true) { 108 var username = document.getElementById ( "username"+index ).innerText 109 var xmlhttp = new XMLHttpRequest(); 110 xmlhttp.onreadystatechange = function() { 111 if (this.readyState == 4 && this.status == 200) { 112 document.getElementById("risultato").innerHTML = this.responseText; 113 } 220 114 } 221 } 222 xmlhttp.open("GET","../principale.php?funzione=salvaUtente&username="+username+"&op=cancella",true); 223 xmlhttp.send(); 115 xmlhttp.open("GET","../principale.php?funzione=salvaUtente&username="+username+"&op=cancella",true); 116 xmlhttp.send(); 224 117 225 // document.getElementById("riga"+index).style.display = 'none' 118 // document.getElementById("riga"+index).style.display = 'none' 119 } 226 120 } 227 228 121 </script> -
admin/modules/salva_consultazione.php
r65575a8 ra1f2a9f 28 28 if (isset($param['disgiunto'])) $disgiunto=addslashes($param['disgiunto']); else $disgiunto=''; 29 29 if (isset($param['proiezione'])) $proiezione=addslashes($param['proiezione']); else $proiezione=''; 30 if($preferita =='on') {30 if($preferita == 'true') { 31 31 $preferita=1; 32 32 $sql="update ".$prefix."_ele_cons_comune set preferita='0' where preferita='1'"; … … 65 65 }elseif($op=='cancella'){ 66 66 #delete 67 $sql="select * from ".$prefix."_ele_cons_comune where id_cons_gen='$id_cons_gen'"; 68 $compl = $dbi->prepare("$sql"); 69 $compl->execute(); 70 $row=$compl->fetchAll(PDO::FETCH_ASSOC); 71 $id_cons=$row[0]['id_cons']; 72 $sql="delete from ".$prefix."_ele_voti_candidato where id_cons='$id_cons'"; 73 $compl = $dbi->prepare("$sql"); 74 $compl->execute(); 75 $sql="delete from ".$prefix."_ele_voti_lista where id_cons='$id_cons'"; 76 $compl = $dbi->prepare("$sql"); 77 $compl->execute(); 78 $sql="delete from ".$prefix."_ele_voti_gruppo where id_cons='$id_cons'"; 79 $compl = $dbi->prepare("$sql"); 80 $compl->execute(); 81 $sql="delete from ".$prefix."_ele_voti_parziale where id_cons='$id_cons'"; 82 $compl = $dbi->prepare("$sql"); 83 $compl->execute(); 84 $sql="delete from ".$prefix."_ele_candidato where id_cons='$id_cons'"; 85 $compl = $dbi->prepare("$sql"); 86 $compl->execute(); 87 $sql="delete from ".$prefix."_ele_lista where id_cons='$id_cons'"; 88 $compl = $dbi->prepare("$sql"); 89 $compl->execute(); 90 $sql="delete from ".$prefix."_ele_gruppo where id_cons='$id_cons'"; 91 $compl = $dbi->prepare("$sql"); 92 $compl->execute(); 93 $sql="delete from ".$prefix."_ele_come where id_cons='$id_cons'"; 94 $compl = $dbi->prepare("$sql"); 95 $compl->execute(); 96 $sql="delete from ".$prefix."_ele_link where id_cons='$id_cons'"; 97 $compl = $dbi->prepare("$sql"); 98 $compl->execute(); 99 $sql="delete from ".$prefix."_ele_numero where id_cons='$id_cons'"; 100 $compl = $dbi->prepare("$sql"); 101 $compl->execute(); 102 $sql="delete from ".$prefix."_ele_controllo where id_cons='$id_cons'"; 103 $compl = $dbi->prepare("$sql"); 104 $compl->execute(); 105 $sql="delete from ".$prefix."_ele_operatore where id_cons='$id_cons'"; 106 $compl = $dbi->prepare("$sql"); 107 $compl->execute(); 108 $sql="delete from ".$prefix."_ele_sezione where id_cons='$id_cons'"; 109 $compl = $dbi->prepare("$sql"); 110 $compl->execute(); 111 $sql="delete from ".$prefix."_ele_sede where id_cons='$id_cons'"; 112 $compl = $dbi->prepare("$sql"); 113 $compl->execute(); 114 $sql="delete from ".$prefix."_ele_circoscrizione where id_cons='$id_cons'"; 115 $compl = $dbi->prepare("$sql"); 116 $compl->execute(); 117 67 118 $sql="delete from ".$prefix."_ele_consultazione where id_cons_gen='$id_cons_gen'"; 68 119 $compl = $dbi->prepare("$sql"); … … 71 122 $compl = $dbi->prepare("$sql"); 72 123 $compl->execute(); 73 if( $compl->rowCount()) $salvato=1;124 if(!$compl->rowCount()) $salvato=1; 74 125 } 75 126 }else{ -
admin/modules/salva_utente.php
r65575a8 ra1f2a9f 12 12 13 13 $param=strtolower($_SERVER['REQUEST_METHOD']) == 'get' ? $_GET : $_POST; 14 if (isset($param['descrizione'])) $descrizione=addslashes($param['descrizione']); else $descrizione=''; 14 if (isset($param['username'])) $username=addslashes($param['username']); else $username=''; 15 if (isset($param['password'])) $password=addslashes($param['password']); else $password=''; 16 if (isset($param['email'])) $email=addslashes($param['email']); else $email=''; 17 if (isset($param['nominativo'])) $nominativo=addslashes($param['nominativo']); else $nominativo=''; 15 18 if (isset($param['op'])) $op=addslashes($param['op']); else $op=''; 16 if (isset($param['indirizzo'])) $indirizzo=addslashes($param['indirizzo']); else $indirizzo='';17 if (isset($param['cap'])) $cap=addslashes($param['cap']); else $cap='';18 if (isset($param['email'])) $email=addslashes($param['email']); else $email='';19 if (isset($param['centralino'])) $centralino=addslashes($param['centralino']); else $centralino='';20 if (isset($param['fax'])) $fax=addslashes($param['fax']); else $fax='';21 if (isset($param['fascia'])) $fascia=intval($param['fascia']); else $fascia='0';22 if (isset($param['id_comune'])) $id_comune=addslashes($param['id_comune']); else $id_comune='';23 if (isset($param['capoluogo'])) $capoluogo=intval($param['capoluogo']); else $capoluogo='0';24 #if (isset($param['predefinito'])) $predefinito=addslashes($param['predefinito']); else $predefinito='';25 19 26 $stemmanome=''; $stemmablob=''; 27 $cond2=''; 28 $cond3=''; 29 if(isset($_FILES['stemma'])) { 30 $STEMM=$_FILES['stemma']; 31 $filestemma=$STEMM['tmp_name']; 32 $nomestemma=$STEMM['name']; 33 #### Controllo della dimensione del file immagine 34 if ($filestemma){ 35 $filestemma=imgresize($filestemma); 36 $stemmablob=addslashes($filestemma); 37 $stemmanome=addslashes($nomestemma); 38 $cond2=", simbolo='$stemmanome', stemma='$stemmablob'"; 39 $cond3="and simbolo='$stemmanome' and stemma='$stemmablob'"; 40 $cond4=", simbolo='$stemmanome'"; 41 } else { 42 # if ( $delsimb=='false') $cond2=", simbolo='', stemma=''"; # aggiungere controllo per eliminazione stemma 43 # else 44 $cond2=''; 45 $cond3=''; 46 $cond4=''; 47 } 48 } 49 50 51 global $prefix,$aid,$dbi; 20 global $prefix,$aid,$dbi,$id_comune; 52 21 $salvato=0; 53 $query="select * from ".$prefix."_ ele_comune where id_comune='$id_comune'";22 $query="select * from ".$prefix."_authors where aid='$username'"; 54 23 $res = $dbi->prepare("$query"); 55 24 $res->execute(); 56 25 if($res->rowCount()) { 57 26 if($op=='salva') { 58 $sql2="descrizione='$descrizione' and indirizzo='$indirizzo' and cap='$cap' and email='$email' and centralino='$centralino' and fax='$fax' and fascia='$fascia' and capoluogo='$capoluogo'"; 59 $sql="select * from ".$prefix."_ele_comune where descrizione='$descrizione' and indirizzo='$indirizzo' and cap='$cap' and email='$email' and centralino='$centralino' and fax='$fax' and fascia='$fascia' and capoluogo='$capoluogo' $cond3"; 60 $res = $dbi->prepare("$sql"); 61 $res->execute(); 62 if(!$res->rowCount()) { 27 if($password=='********') $pass="pwd='$password'"; else $pass=""; 63 28 #update 64 $sql="update ".$prefix."_ ele_comune set descrizione='$descrizione',indirizzo='$indirizzo',cap='$cap',email='$email',centralino='$centralino',fax='$fax',fascia='$fascia',capoluogo='$capoluogo' $cond2 where id_comune='$id_comune'";29 $sql="update ".$prefix."_authors set name='$nominativo',email='$email',$pass where aid='$username'"; 65 30 $compl = $dbi->prepare("$sql"); 66 31 $compl->execute(); 67 32 if($compl->rowCount()) $salvato=1; 68 }else $salvato=1;69 33 }elseif($op=='cancella'){ 70 34 #delete 71 $sql="delete from ".$prefix."_ele_comune where id_comune='$id_comune'"; 72 $sql2=$sql; 35 $sql="delete from ".$prefix."_authors where aid='$username'"; 73 36 $compl = $dbi->prepare("$sql"); 74 37 $compl->execute(); … … 77 40 }else{ 78 41 #insert 79 $sql2="values( '$id_comune','$descrizione','$indirizzo','$centralino','$fax','$email','$fascia','$capoluogo','$stemmanome')"; 80 $sql="insert into ".$prefix."_ele_comune values( '$id_comune','$descrizione','$indirizzo','$centralino','$fax','$email','$fascia','$capoluogo','$stemmanome','$stemmablob','0','$cap','')"; 42 $sql="insert into ".$prefix."_authors values( '$username','$nominativo','$id_comune','$email','$password','','1','0','0','it')"; 81 43 $compl = $dbi->prepare("$sql"); 82 44 $compl->execute(); … … 87 49 $datal=date('Y-m-d'); 88 50 $orariol=date(' H:i:s'); 89 $riga=addslashes($sql 2);51 $riga=addslashes($sql); 90 52 $sqlog="insert into ".$prefix."_ele_log values('$id_cons','0','$aid','$datal','$orariol','','$riga','".$prefix."_ele_comune')"; 91 53 $res = $dbi->prepare("$sqlog"); … … 95 57 echo "<tr><td colspan=\"8\">Errore, impossibile salvare i dati - $sql</td></tr>"; 96 58 } 97 include('modules/elenco_comuni.php'); 98 99 function imgresize($file) { 100 $source_pic = $file; 101 $max_width = 100; 102 $max_height = 100; 103 list($width, $height, $image_type) = getimagesize($file); 104 switch ($image_type) 105 { 106 case 1: $src = imagecreatefromgif($file); break; 107 case 2: $src = imagecreatefromjpeg($file); break; 108 case 3: $src = imagecreatefrompng($file); break; 109 default: return ''; break; 110 } 111 $x_ratio = $max_width / $width; 112 $y_ratio = $max_height / $height; 113 if( ($width <= $max_width) && ($height <= $max_height) ){ 114 $tn_width = $width; 115 $tn_height = $height; 116 }elseif (($x_ratio * $height) < $max_height){ 117 $tn_height = ceil($x_ratio * $height); 118 $tn_width = $max_width; 119 }else{ 120 $tn_width = ceil($y_ratio * $width); 121 $tn_height = $max_height; 122 } 123 $tmp = imagecreatetruecolor($tn_width,$tn_height); 124 /* Controllo della trasparenza*/ 125 if(($image_type == 1) OR ($image_type==3)) 126 { 127 imagealphablending($tmp, false); 128 imagesavealpha($tmp,true); 129 $transparent = imagecolorallocatealpha($tmp, 255, 255, 255, 127); 130 imagefilledrectangle($tmp, 0, 0, $tn_width, $tn_height, $transparent); 131 } 132 imagecopyresampled($tmp,$src,0,0,0,0,$tn_width, $tn_height,$width,$height); 133 ob_start(); 134 switch ($image_type) 135 { 136 case 1: imagegif($tmp); break; 137 case 2: imagejpeg($tmp, NULL, 100); break; // best quality 138 case 3: imagepng($tmp, NULL, 0); break; // no compression 139 default: echo ''; break; 140 } 141 $final_image = ob_get_contents(); 142 ob_end_clean(); 143 return $final_image; 144 } 59 include('modules/elenco_utenti.php'); 145 60 146 61 ?> -
admin/principale.php
r65575a8 ra1f2a9f 84 84 include("modules/salva_consultazione.php"); 85 85 break; 86 case 'salvaUtente': 87 include("modules/salva_utente.php"); 88 break; 86 89 } 87 90
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/eleonline4/chrome/common/trac_banner.png)