Changeset a1f2a9f


Ignore:
Timestamp:
Dec 5, 2025, 11:11:32 PM (2 days ago)
Author:
rgigli <147847165+rgigli@…>
Branches:
main
Children:
b8095d1
Parents:
65575a8
Message:

Funzione di gestione utenti

Collegata al db la funzione di gestione degli utenti e completata quella di gestione delle consultazioni

Location:
admin
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • admin/modules/contenuto.php

    r65575a8 ra1f2a9f  
    7070    $op = $defaultPage;
    7171}
    72 echo "<img src=\"../logo.jpg\" alt=\"\" />";
     72#echo "<img src=\"../logo.jpg\" alt=\"\" />";
    7373// Includo la pagina corrispondente
    7474include($pagesMap[$op]);
  • admin/modules/elenco_consultazioni.php

    r65575a8 ra1f2a9f  
    1111echo "<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>";
    1212if($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>";
     13echo "</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>";
    1414}
    1515
  • admin/modules/elenco_utenti.php

    r65575a8 ra1f2a9f  
    44else
    55        require_once '../includes/check_access.php';
    6        
     6global $currentUserRole;
    77$row=elenco_utenti();
    88# ciclo ancora da adattare
    99foreach($row as $key=>$val){
    1010        $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>";
    1212        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>";
    1313} #die("TEST:  --- ".count($row));
  • admin/modules/gestione_consultazioni.php

    r65575a8 ra1f2a9f  
    173173        const linkDait = document.getElementById ( "link" ).value
    174174        const tipo = document.getElementById ( "tipo" ).value
    175         const preferita = document.getElementById ( "preferita" ).value
     175        const preferita = document.getElementById ( "preferita" ).checked
    176176        const id_cons_gen = document.getElementById ( "id_cons_gen" ).value
    177177        const chiusa = document.getElementById ( "chiusa" ).value
     
    217217
    218218    })
    219     .catch(error => {
    220         console.error('Errore durante l\'upload:', error);
    221         risultato.innerHTML = 'Si è verificato un errore durante l\'upload.';
    222     });
    223219};
    224220
    225221
    226222  function deleteConsultazione(index) {
     223        if (confirm("Confermi l'eliminazione?") == true) { 
    227224        var id_cons_gen = document.getElementById ( "id_cons_gen"+index ).innerText
    228225    var xmlhttp = new XMLHttpRequest();
     
    234231    xmlhttp.open("GET","../principale.php?funzione=salvaConsultazione&id_cons_gen="+id_cons_gen+"&op=cancella",true);
    235232    xmlhttp.send();
    236 
     233        }
    237234//      document.getElementById("riga"+index).style.display = 'none'
    238235  }
     236 
    239237   function editConsultazione(index) {
    240238        document.getElementById ( "id_cons_gen" ).value = document.getElementById ( "id_cons_gen"+index ).innerText
  • admin/modules/gestione_utenti.php

    r65575a8 ra1f2a9f  
    11<?php
    22require_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 sezioni
    8 $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 database
    30     require_once '../includes/db.php'; // o modifica con il tuo file di connessione
    31 
    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 extra
    43     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 
    1033?>
    104 
    1054<!-- CONTENUTO HTML -->
    1065<section class="content">
     
    11413  </div>
    11514  <div class="card-body">
    116     <form id="userForm">
     15    <form id="userForm" onsubmit="aggiungiUser(event)">
    11716      <div class="form-row">
    11817        <div class="form-group col-md-3">
     
    13534
    13635
    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>
    13938    </form>
    14039  </div>
     
    15655        </tr>
    15756      </thead>
    158       <tbody id="userRows"><?php include('elenco_utenti.php'); ?></tbody>
     57      <tbody id="risultato"><?php include('elenco_utenti.php'); ?></tbody>
    15958    </table>
    16059  </div>
     
    16463
    16564function editUser(id) {
    166   const u = users.find(u => u.id === id);
    167   if (!u) return;
    16865  document.getElementById('username').value = document.getElementById('username'+id).innerText;
    169   document.getElementById('password').value = '';
     66  document.getElementById('password').value = '********';
    17067  document.getElementById('email').value = document.getElementById('email'+id).innerText;
    17168  document.getElementById('nominativo').value = document.getElementById('nominativo'+id).innerText;;
    172   document.getElementById ( "saveBtn" ).textContent = "Salva modifiche";
     69  document.getElementById ( "submitBtn" ).textContent = "Salva modifiche";
    17370
    17471}
     
    19996    .then(response => response.text()) // O .json() se il server risponde con JSON
    20097    .then(data => {
     98                const myForm = document.getElementById('userForm');
    20199        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
    207103    })
    208     .catch(error => {
    209         console.error('Errore durante l\'upload:', error);
    210         risultato.innerHTML = 'Si è verificato un errore durante l\'upload.';
    211     });
    212104};
    213105
    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                        }
    220114                }
    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();
    224117
    225 //      document.getElementById("riga"+index).style.display = 'none'
     118        //      document.getElementById("riga"+index).style.display = 'none'
     119          }
    226120  }
    227 
    228121</script>
  • admin/modules/salva_consultazione.php

    r65575a8 ra1f2a9f  
    2828if (isset($param['disgiunto'])) $disgiunto=addslashes($param['disgiunto']); else $disgiunto='';
    2929if (isset($param['proiezione'])) $proiezione=addslashes($param['proiezione']); else $proiezione='';
    30 if($preferita=='on') {
     30if($preferita == 'true') {
    3131        $preferita=1;
    3232        $sql="update ".$prefix."_ele_cons_comune set preferita='0' where preferita='1'";
     
    6565        }elseif($op=='cancella'){       
    6666                #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               
    67118                $sql="delete from ".$prefix."_ele_consultazione where  id_cons_gen='$id_cons_gen'";
    68119                $compl = $dbi->prepare("$sql");
     
    71122                $compl = $dbi->prepare("$sql");
    72123                $compl->execute();
    73                 if($compl->rowCount()) $salvato=1;
     124                if(!$compl->rowCount()) $salvato=1;
    74125        }
    75126}else{
  • admin/modules/salva_utente.php

    r65575a8 ra1f2a9f  
    1212
    1313$param=strtolower($_SERVER['REQUEST_METHOD']) == 'get' ? $_GET : $_POST;
    14 if (isset($param['descrizione'])) $descrizione=addslashes($param['descrizione']); else $descrizione='';
     14if (isset($param['username'])) $username=addslashes($param['username']); else $username='';
     15if (isset($param['password'])) $password=addslashes($param['password']); else $password='';
     16if (isset($param['email'])) $email=addslashes($param['email']); else $email='';
     17if (isset($param['nominativo'])) $nominativo=addslashes($param['nominativo']); else $nominativo='';
    1518if (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='';
    2519
    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;
     20global $prefix,$aid,$dbi,$id_comune;
    5221$salvato=0;
    53 $query="select * from ".$prefix."_ele_comune where id_comune='$id_comune'";
     22$query="select * from ".$prefix."_authors where aid='$username'";
    5423$res = $dbi->prepare("$query");
    5524$res->execute();
    5625if($res->rowCount()) {
    5726        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="";
    6328                        #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'";
    6530                        $compl = $dbi->prepare("$sql");
    6631                        $compl->execute();
    6732                        if($compl->rowCount()) $salvato=1;
    68                 }else $salvato=1;
    6933        }elseif($op=='cancella'){
    7034                #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'";
    7336                $compl = $dbi->prepare("$sql");
    7437                $compl->execute();
     
    7740}else{
    7841        #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')";
    8143                $compl = $dbi->prepare("$sql");
    8244                $compl->execute();
     
    8749        $datal=date('Y-m-d');
    8850        $orariol=date(' H:i:s');
    89         $riga=addslashes($sql2);
     51        $riga=addslashes($sql);
    9052        $sqlog="insert into ".$prefix."_ele_log values('$id_cons','0','$aid','$datal','$orariol','','$riga','".$prefix."_ele_comune')";
    9153        $res = $dbi->prepare("$sqlog");
     
    9557        echo "<tr><td colspan=\"8\">Errore, impossibile salvare i dati - $sql</td></tr>";
    9658}
    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 }
     59include('modules/elenco_utenti.php');
    14560
    14661?>
  • admin/principale.php

    r65575a8 ra1f2a9f  
    8484                        include("modules/salva_consultazione.php");
    8585                        break;
     86                case 'salvaUtente':
     87                        include("modules/salva_utente.php");
     88                        break;
    8689        }
    8790       
Note: See TracChangeset for help on using the changeset viewer.