Changeset 255 for trunk/admin/modules/Elezioni/ele_affluenze.php
- Timestamp:
- Mar 20, 2018, 11:19:10 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/modules/Elezioni/ele_affluenze.php
r53 r255 15 15 } 16 16 17 global $dbi; 17 18 $aid=$_SESSION['aid']; 18 $dbi=$_SESSION['dbi'];19 #$dbi=$_SESSION['dbi']; 19 20 $prefix=$_SESSION['prefix']; 20 21 $currentlang=$_SESSION['lang']; … … 22 23 $perms=ChiSei(0); 23 24 if ($perms<256 or !$id_cons_gen) die("Non hai i permessi per inserire dati, o non hai scelto la consultazione!"); 24 $res = mysql_query("SELECT t1.tipo_cons,t2.genere,t1.descrizione FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_tipo as t2 where t1.tipo_cons=t2.tipo_cons and t1.id_cons_gen='$id_cons_gen' " , $dbi); 25 list($tipo_cons,$genere,$descr_cons) = mysql_fetch_row($res); 25 26 #include_once("modules/Elezioni/query.sql"); 27 include("modules/Elezioni/funzionidata.php"); 28 include("modules/Elezioni/ele.php"); 29 $row=descr_cons();$tipo_cons=$row[0];$genere=$row[1];$descr_cons=$row[2]; 30 26 31 if (isset($_GET['min'])) $min=intval($_GET['min']); else $min=0; 27 32 if (isset($_GET['do'])) get_magic_quotes_gpc() ? $do=$param['do']:$do=addslashes($param['do']); else $do=''; … … 36 41 if (isset($_GET['help'])) $help=intval($_GET['help']); 37 42 38 include("modules/Elezioni/funzionidata.php");39 include("modules/Elezioni/ele.php");40 43 $offset=15; 41 44 $hiddenInfo = "<input type=\"hidden\" name=\"min\" value=\"$min\">"; … … 58 61 # echo "<td bgcolor=\"$bgcolor1\"> </td>"; 59 62 echo "<td bgcolor=\"$bgcolor1\"> </td></tr>"; 60 $res = mysql_query("SELECT * FROM ".$prefix."_ele_rilaff where id_cons_gen=$id_cons_gen order by data,orario", $dbi); 61 $max = mysql_num_rows($res); 62 63 $row=getaffluenze(); 64 $max = count($row); 63 65 echo "<form name=\"rilaff\" action=\"admin.php\">" 64 66 ."<input type=\"hidden\" name=\"op\" value=\"rec_add_aff\">" … … 69 71 echo "<select name= \"mv\" ><option value=\"00\" selected>00</option>"; minuti(); 70 72 echo "</td><td>"; 71 $aff = mysql_query("SELECT data_inizio,data_fine FROM ".$prefix."_ele_consultazione where id_cons_gen='$id_cons_gen'", $dbi);72 list($data,$fine) = mysql_fetch_row($aff);73 $aff = daticonsultazione(); 74 $data=$aff['data_inizio'];$fine=$aff['data_fine']; 73 75 list ($anno,$mese,$giorno)=explode('-',$data); 74 76 list ($annof,$mesef,$giornof)=explode('-',$fine); … … 84 86 if ($max != "0") { 85 87 $i=1; 86 while(list($id_cons2,$orario,$data) = mysql_fetch_row($res)){ 88 foreach($row as $aff) 89 { 90 $id_cons2=$aff[0]; 91 $orario=$aff[1]; 92 $data=$aff[2]; 87 93 // esplode la data 88 94 $bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1']; … … 108 114 ."</tr>"; 109 115 } 110 } 116 } 111 117 echo "</table>"; 112 118 } … … 119 125 $data="$av-$msv-$gv"; 120 126 $orario="$ov:$mv:00"; 121 $confr = mysql_query("SELECT data_inizio, data_fine FROM ".$prefix."_ele_consultazione WHERE id_cons_gen ='$id_cons_gen'", $dbi); 122 list($dadata, $adata) = mysql_fetch_row($confr); 127 $row = daticonsultazione(); 128 # mysql_query("SELECT data_inizio, data_fine FROM ".$prefix."_ele_consultazione WHERE id_cons_gen ='$id_cons_gen'", $dbi); 129 $dadata=$row['data_inizio']; $adata=$row['data_fine']; 123 130 $dadata=strtotime($dadata); 124 131 $adata=strtotime($adata); 125 132 $cdata=strtotime($data); 126 133 // verifica se data e ora esiste e fa l'upgrade 127 $res = mysql_query("select * from ".$prefix."_ele_rilaff where id_cons_gen='$id_cons_gen' and data='$data' and orario='$orario'", $dbi); 128 $tipo= mysql_num_rows($res); 134 $sql = "select * from ".$prefix."_ele_rilaff where id_cons_gen='$id_cons_gen' and data='$data' and orario='$orario'"; 135 $sth = $dbi->prepare("$sql"); 136 $sth->execute(); 137 $row = $sth->fetchAll(); 138 $tipo= $sth->rowCount(); 129 139 if(($tipo==0) and ($dadata <= $cdata) and ($adata >= $cdata)){ 130 140 if(checkdate(intval($msv),intval($gv),intval($av))){ 131 $result = mysql_query("insert into ".$prefix."_ele_rilaff values ('$id_cons_gen','$orario','$data')", $dbi)|| die("Impossibile inserire i dati! ".mysql_error()); 141 $sql="insert into ".$prefix."_ele_rilaff values ('$id_cons_gen','$orario','$data')"; 142 $sth = $dbi->prepare("$sql"); 143 $sth->execute(); 132 144 } 133 145 Header("Location: admin.php?op=rec_add_aff&id_cons_gen=$id_cons_gen"); … … 142 154 die(); 143 155 }else{ 144 $res = mysql_query("select id_cons from ".$prefix."_ele_cons_comune where id_cons_gen='$id_cons_gen'", $dbi); 145 while (list($id_cons2) = mysql_fetch_row($res)) 146 mysql_query("delete from ".$prefix."_ele_voti_parziale where id_cons='$id_cons2' and data='$data' and orario='$orario'", $dbi)|| die("Impossibile cancellare i dati! ".mysql_error()); 147 mysql_query("delete from ".$prefix."_ele_rilaff where id_cons_gen='$id_cons_gen' and data='$data' and orario='$orario'", $dbi)|| die("Impossibile cancellare i dati! ".mysql_error()); 156 $sql = "select id_cons from ".$prefix."_ele_cons_comune where id_cons_gen='$id_cons_gen'"; 157 $sth = $dbi->prepare("$sql"); 158 $sth->execute(); 159 $row2 = $sth->fetchAll(); 160 foreach($row2 as $id_cons2) { 161 $sql = "delete from ".$prefix."_ele_voti_parziale where id_cons='$id_cons2' and data='$data' and orario='$orario'"; 162 $sth = $dbi->prepare("$sql"); 163 $sth->execute(); 164 } 165 $sql = "delete from ".$prefix."_ele_rilaff where id_cons_gen='$id_cons_gen' and data='$data' and orario='$orario'"; 166 $sth = $dbi->prepare("$sql"); 167 $sth->execute(); 148 168 Header("Location: admin.php?op=rec_add_aff&id_cons_gen=$id_cons_gen&contr=$data"); 149 169 }
Note:
See TracChangeset
for help on using the changeset viewer.