Changeset 255
- Timestamp:
- Mar 20, 2018, 11:19:10 PM (7 years ago)
- Location:
- trunk/admin
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/admin.php
r254 r255 21 21 // Versione di php 22 22 $phpver = phpversion(); 23 23 global $dbi; 24 24 // converte superglobal se php e' < 4.1.0 25 25 … … 115 115 //=================================================================== 116 116 session_name('sesadmin'); 117 session_start();//MODIFICHE PER GESTIONE SESSIONI117 #session_start();//MODIFICHE PER GESTIONE SESSIONI 118 118 // gestione sessione 119 $a = session_id(); 120 if(empty($a)) session_start(); 121 #echo "SID: ".SID."<br>session_id(): ".session_id()."<br>COOKIE: ".$_COOKIE["PHPSESSID"]; 119 122 120 123 if (file_exists("config.php")){ … … 123 126 $install="1"; 124 127 } 125 126 128 127 129 # verifica se effettuata la configurazione … … 151 153 $sth = $dbi->prepare("select * from ".$prefix."_config"); 152 154 $sth->execute(); 153 154 $row = $sth->fetch(PDO::FETCH_ASSOC);155 $row = $sth->fetch(PDO::FETCH_ASSOC); 156 #$row = $sth->fetchAll(); 155 157 $siteistat=$row['siteistat']; 156 158 if (!isset($_SESSION['id_comune'])){ … … 168 170 $_SESSION['blocco']=$row['blocco']; 169 171 $_SESSION['testata']=$row['testata']; 170 $_SESSION['logo']=$row['logo'];172 # $_SESSION['logo']=$row['logo']; 171 173 $_SESSION['fileout']=$row['fileout']; 172 174 $_SESSION['copyright']=$row['copyright']; … … 174 176 $_SESSION['patch']=$row['patch']; 175 177 $_SESSION['id_comune']=$row['siteistat']; 176 $_SESSION['multicomune']=$ multicomune;177 $_SESSION['flash']=$ flash;178 $_SESSION['displayerrors']=$ displayerrors;179 $_SESSION['editor']=$ editor;180 $_SESSION['tema_on']=$ tema_on;181 $_SESSION['ed_user']=$ ed_user;178 $_SESSION['multicomune']=$row['multicomune']; 179 $_SESSION['flash']=$row['flash']; 180 $_SESSION['displayerrors']=$row['displayerrors']; 181 $_SESSION['editor']=$row['editor']; 182 $_SESSION['tema_on']=$row['tema_on']; 183 $_SESSION['ed_user']=$row['ed_user']; 182 184 } 183 185 //fine … … 214 216 $sth = $dbi->prepare("update ".$prefix."_authors set counter=$counter where aid='$aid' and pwd='$mpwd' and id_comune='$id_comune'"); 215 217 $sth->execute(); 216 $row = $sth->fetch(PDO::FETCH_ASSOC);218 # $row = $sth->fetch(PDO::FETCH_ASSOC); 217 219 218 220 if ($esiste==1) { 219 $_SESSION['dbi']=$dbi;221 # $_SESSION['dbi']=$dbi; 220 222 $_SESSION['aid']="$aid"; 221 223 $_SESSION['pwd']="$mpwd"; … … 231 233 } 232 234 }else{ 233 $_SESSION['dbi']=$dbi;234 235 } 235 #$_SESSION['dbi']=$dbi; 236 237 } 236 238 if (! isset($_SESSION['lang'])) $_SESSION['lang']=$language; 237 239 $currentlang=strlen($_SESSION['lang'])==2 ? $_SESSION['lang']: $language; … … 240 242 //lettura sessione 241 243 $aid=$_SESSION['aid']; 242 $dbi=$_SESSION['dbi'];244 #$dbi=$_SESSION['dbi']; 243 245 $prefix=$_SESSION['prefix']; 244 246 $id_comune=$_SESSION['id_comune']; … … 247 249 $sth = $dbi->prepare("select id_cons_gen from ".$prefix."_ele_cons_comune where preferita='1' and (id_comune='$id_comune' or id_comune=0)"); 248 250 $sth->execute(); 249 $row = $sth->fetch(PDO::FETCH_ ASSOC);250 $id_cons_gen=$row[ 1];251 $row = $sth->fetch(PDO::FETCH_BOTH); 252 $id_cons_gen=$row[0]; 251 253 } 252 254 $currentlang=$_SESSION['lang']; … … 264 266 /*********************************************************/ 265 267 function ChiSei($id_cons_gen){ 266 268 global $dbi; 267 269 268 270 $aid=$_SESSION['aid']; 269 $dbi=$_SESSION['dbi'];271 #$dbi=$_SESSION['dbi']; 270 272 $prefix=$_SESSION['prefix']; 271 273 $pwd=$_SESSION['pwd']; … … 334 336 if($multicomune=='1'){ 335 337 echo ""._COMUNE."</td><td>"; 336 $sqlcomu="select id_comune,descrizione from ".$prefix."_ele_comuni order by descrizione asc"; 337 $rescomu= mysql_query("$sqlcomu",$dbi); 338 338 $row=elenco_comuni(); 339 339 echo "<select name=\"id_comune\">"; 340 while (list($id,$descrizione)=mysql_fetch_row($rescomu))341 { 340 foreach($row as $comuni) 341 {$id=$comuni[0];$descrizione=$comuni[1]; 342 342 $sel=($id == $id_comune) ? "selected":""; 343 343 echo "<option value=\"$id\" $sel>$descrizione"; … … 388 388 } 389 389 390 391 #echo "op:".$param['op']." -- aid:".$_SESSION['aid']."remote:".$_SESSION['remote']."REMOTE:".$_SERVER['REMOTE_ADDR']; 390 392 if (isset($param['op'])) get_magic_quotes_gpc() ? $op=$param['op']:$op=addslashes($param['op']); else $op='ele'; 391 393 //if (isset($param['op'])) $op=$param['op']; else $op='ele'; … … 565 567 } 566 568 567 568 569 ?> -
trunk/admin/modules/Elezioni/ele.php
r254 r255 21 21 } 22 22 } 23 23 global $dbi; 24 24 $aid=$_SESSION['aid']; 25 $dbi=$_SESSION['dbi'];25 #$dbi=$_SESSION['dbi']; 26 26 $id_comune=$_SESSION['id_comune']; 27 27 $prefix=$_SESSION['prefix']; … … 42 42 } 43 43 } 44 45 if ($id_cons_gen) { 46 if ($id_comune and $perms<256) 47 $sql = "SELECT t1.tipo_cons,t1.descrizione,t2.id_cons_gen FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2 where t1.id_cons_gen=t2.id_cons_gen and t2.id_cons_gen='$id_cons_gen'"; 48 else 49 $sql = "SELECT t1.tipo_cons,t1.descrizione,t1.id_cons_gen FROM ".$prefix."_ele_consultazione as t1 where t1.id_cons_gen='$id_cons_gen'"; 50 }else{ 51 if($perms>128) 52 $sql = "SELECT tipo_cons,descrizione,id_cons_gen FROM ".$prefix."_ele_consultazione order by data_fine desc limit 0,1 "; 53 else 54 $sql = "SELECT t1.tipo_cons,t1.descrizione,t2.id_cons_gen FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2, ".$prefix."_ele_operatori as t3 where t3.id_comune=$id_comune and t3.id_comune=t2.id_comune and t1.id_cons_gen=t2.id_cons_gen and t2.chiusa='0' and (t3.id_cons=t2.id_cons or t3.id_cons=0) and t3.permessi>0 and t3.aid='$aid' order by t1.data_fine desc limit 0,1 "; 55 } 56 57 $res = mysql_query("$sql",$dbi); 58 $espandi=0; 59 if (mysql_num_rows($res)) 60 list($tipo_cons,$descr_cons,$id_cons_gen) = mysql_fetch_row($res); 61 $res = mysql_query("SELECT t2.id_cons FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2 where t1.id_cons_gen=t2.id_cons_gen and t2.id_cons_gen='$id_cons_gen' and t2.id_comune='$id_comune'" , $dbi); 62 if (mysql_num_rows($res)) list($id_cons) = mysql_fetch_row($res); 63 else $espandi=1; 64 if(!isset($tipo_cons))$tipo_cons=0; 65 $res = mysql_query("SELECT genere,voto_g,voto_l,voto_c,circo FROM ".$prefix."_ele_tipo where tipo_cons='$tipo_cons' and lingua='$currentlang'" , $dbi); 66 list($genere,$votog,$votol,$votoc,$conscirc) = mysql_fetch_row($res); 44 include_once("modules/Elezioni/query.sql"); 45 46 $row=setconsultazione(); $tipo_cons=$row[0]; $descr_cons=$row[1];$id_cons_gen=$row[2]; 47 $row=tipocons(); $genere=$row[0];$votog=$row[1];$votol=$row[2];$votoc=$row[3];$conscirc=$row[4]; 48 67 49 if (!$perms) $perms=ChiSei($id_cons_gen); 68 50 //include("modules/Elezioni/language/lang-$currentlang.php"); … … 70 52 // ELE 71 53 //************************************************************************** 72 if(!isset($id_cons))$id_cons=0; 73 74 $res = mysql_query("SELECT t1.limite FROM ".$prefix."_ele_conf as t1 left join ".$prefix."_ele_cons_comune as t2 on t1.id_conf=t2.id_conf where t2.id_cons='$id_cons'" , $dbi); 75 list($limite) = mysql_fetch_row($res); 54 76 55 77 56 function ele() { … … 84 63 $bullet_red="<img src=\"temi/$tema/images/bullet_red.gif\" alt =\" \" align=\"left\" border=\"0\">"; 85 64 $bgcolor1='#e7e7e7'; 86 $sqlcomu="select descrizione from ".$prefix."_ele_comuni where id_comune='$id_comune'"; 87 $res = mysql_query($sqlcomu); 88 list($descr_comu)=mysql_fetch_row($res); 65 $row=descr_comune();$descr_comu=$row['descrizione']; 66 # $sqlcomu="select descrizione from ".$prefix."_ele_comuni where id_comune='$id_comune'"; 67 # $res = mysql_query($sqlcomu); 68 # list($descr_comu)=mysql_fetch_row($res); 89 69 $sqlcomu="select fascia from ".$prefix."_ele_cons_comune where id_cons='$id_cons'"; 90 70 $res = mysql_query($sqlcomu); … … 104 84 echo "<input type=\"hidden\" name=\"pag_cons\" value=\"admin.php?id_cons_gen=\">"; 105 85 echo "<input type=\"hidden\" name=\"op\" value=\"ele\">"; 106 107 if ($perms<128) { 108 $res = mysql_query("select t3.id_cons, t2.descrizione,t4.genere, t2.id_cons_gen, t3.chiusa from ".$prefix."_ele_operatori as t1, ".$prefix."_ele_consultazione as t2, ".$prefix."_ele_cons_comune as t3, ".$prefix."_ele_tipo as t4 where t4.lingua='$currentlang' and t2.tipo_cons=t4.tipo_cons and t1.aid='$aid' and t3.id_cons_gen=t2.id_cons_gen and (t1.id_cons=t3.id_cons or t1.permessi=64) and t1.id_comune=t3.id_comune and t1.id_comune=$id_comune and t3.chiusa='0' order by t2.data_inizio desc", $dbi); 109 }else{ 110 $res = mysql_query("SELECT '', t1.descrizione,t2.genere, t1.id_cons_gen,'' FROM ".$prefix."_ele_consultazione as t1,".$prefix."_ele_tipo as t2 where t2.lingua='$currentlang' and t1.tipo_cons=t2.tipo_cons order by t1.data_inizio desc", $dbi); 111 $sqlcomu="select id_comune,descrizione from ".$prefix."_ele_comuni order by descrizione asc"; 112 } 86 ########################### 87 $row=elenco_cons(); 88 89 90 ################################## 113 91 echo "<font size=-1><b>"._SCELTA_CONS.":</b> </font><select name=\"id_cons_gen\" onChange=\"top.location.href=this.form.pag_cons.value+this.form.id_cons_gen.options[this.form.id_cons_gen.selectedIndex].value;return false\">"; 114 while(list($id,$descrizione,$gen2,$idgen,$chiusa) = mysql_fetch_row($res)) { 92 93 foreach ($row as $riga) 94 { 95 $id=$riga[0];$descrizione=$riga[1];$gen2=$riga[2];$idgen=$riga[3];$chiusa=$riga[4]; 96 # while(list() = mysql_fetch_row($res)) { 115 97 if (($chiusa==0) OR ($perms>32)) { 116 98 if (($idgen==$id_cons_gen or !$id_cons_gen)) { … … 143 125 if ($perms==256) // il superuser puo' scegliere il comune su cui lavorare 144 126 { 145 $r escomu= mysql_query("$sqlcomu",$dbi);127 $row=elenco_comuni(); 146 128 echo "<select name=\"id_comune\" onChange=\"top.location.href=this.form.pag_cons.value+$id_cons_gen+'&id_comune='+this.form.id_comune.options[this.form.id_comune.selectedIndex].value;return false\"><option value=\"\">"; 147 while (list($id,$descrizione)=mysql_fetch_row($rescomu))129 foreach($row as $riga) 148 130 { 131 $id=$riga[0];$descrizione=$riga[1]; 149 132 $sel=($id == $id_comune) ? "selected":""; 150 133 echo "<option value=\"$id\" $sel>$descrizione"; … … 292 275 293 276 //echo "<hr /><a href=\"../client/modules.php\" target=\"_blank\">$bullet Guarda il sito</a><br /><hr />"; 294 echo "<a href=\"admin.php?op=logout\">$bullet "._ESCI. "</a>";277 echo "<a href=\"admin.php?op=logout\">$bullet "._ESCI.$_SESSION['aid']."</a>"; 295 278 echo "</td></tr></table>"; 296 279 // continua la tabella su ele.voti con le sezioni -
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 } -
trunk/admin/modules/Elezioni/ele_configurazione.php
r254 r255 26 26 27 27 $id_comune=$_SESSION['id_comune']; 28 $r es = mysql_query("SELECT t1.tipo_cons,t2.id_cons FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2 where t1.id_cons_gen=t2.id_cons_gen and t2.id_cons_gen='$id_cons_gen' and t2.id_comune='$id_comune' " , $dbi);29 list($tipo_cons,$id_cons) = mysql_fetch_row($res);28 $row=cur_cons(); 29 $tipo_cons=$row[0];$id_cons=$row[1]; 30 30 31 31 include("modules/Elezioni/funzionidata.php"); -
trunk/admin/modules/Elezioni/ele_consultazioni.php
r91 r255 12 12 die ("You can't access this file directly..."); 13 13 } 14 14 global $dbi; 15 15 $aid=$_SESSION['aid']; 16 $dbi=$_SESSION['dbi'];17 16 $prefix=$_SESSION['prefix']; 18 17 $param=strtolower($_SERVER['REQUEST_METHOD']) == 'get' ? $_GET : $_POST; … … 20 19 //if ($perms<128 or !$id_cons_gen) die("Non hai i permessi per inserire dati, o non hai scelto la consultazione!"); 21 20 if ($perms!=256) die("Non hai i permessi per inserire dati, o non hai scelto la consultazione!"); 22 if (isset($param['id_cons_gen'])){ 23 $id_cons_gen=intval($param['id_cons_gen']); 24 $res = mysql_query("SELECT tipo_cons FROM ".$prefix."_ele_consultazione where id_cons_gen=$id_cons_gen " , $dbi); 25 list($tipo_cons) = mysql_fetch_row($res); 26 } else { 27 $id_cons_gen=0; 28 $tipo_cons=0; 29 } 21 30 22 if (isset($param['min'])) $min=intval($param['min']); else $min=0; 31 23 if (isset($param['ok'])) $ok=intval($param['ok']); else $ok=0; … … 62 54 $offset=10; 63 55 if (!isset($min)) $min=0; 64 56 if (isset($param['id_cons_gen'])){ 57 $id_cons_gen=intval($param['id_cons_gen']); 58 $row=descr_cons(); 59 $tipo_cons=$row[0]; 60 #$res = mysql_query("SELECT tipo_cons FROM ".$prefix."_ele_consultazione where id_cons_gen=$id_cons_gen " , $dbi); 61 #list($tipo_cons) = mysql_fetch_row($res); 62 } else { 63 $id_cons_gen=0; 64 $tipo_cons=0; 65 } 65 66 /******************************************************/ 66 67 /*Funzione di visualizzazione globale */ … … 88 89 89 90 if ($do == "modify") { 90 $res = mysql_query("SELECT * FROM ".$prefix."_ele_consultazione where id_cons_gen='$id_cons_gen'", $dbi); 91 $pro= mysql_fetch_array($res, 3); 92 $res_tipo = mysql_query("SELECT * FROM ".$prefix."_ele_tipo where tipo_cons='".$pro['tipo_cons']."' and lingua='$language'", $dbi); 93 $tip=mysql_fetch_array($res_tipo, 3); 94 91 $pro = daticonsultazione(); 92 $tip = datitipo($pro['tipo_cons'],$language); 95 93 list($dia1,$dim1,$dig1) = explode("-",$pro['data_inizio']=="0000-00-00" ? " - - ": $pro['data_inizio']) ; 96 94 list($dfa1,$dfm1,$dfg1) = explode("-",$pro['data_fine']=="0000-00-00" ? " - - ": $pro['data_fine']) ; … … 131 129 echo "<option value=\"$dfa1\" selected>$dfa1</option>"; anno(); 132 130 echo "</td></tr><tr>"; 133 $resdel = mysql_query("SELECT * FROM ".$prefix."_ele_cons_comune where id_cons_gen='$id_cons_gen'", $dbi);134 if( mysql_num_rows($resdel)==0)131 $resdel = daticonscom(); 132 if(count($resdel)==0) 135 133 echo "<td><fieldset><legend>"._SPUNTALABEL1."</legend><label id=\"prov\">"._VIASPUNTAELIMINA." <input type=\"checkbox\" id=\"pwd3\"name=\"pwd3\" value=\"\" onclick=\"del_cons()\"></label></fieldset></td>"; 136 134 else echo "<td></td>"; … … 145 143 ._ADD." "._CONSULTA."<br><br>"; 146 144 echo _DEFCONS.":</h6><br><table width=\"100%\">"; 147 148 $res=mysql_query("SELECT * FROM ".$prefix."_ele_tipo where lingua='$language'", $dbi); 145 $row = elenco_tipi(); 149 146 echo "<tr><td><b>"._TIPO." :</b></td><td>"; 150 147 echo "<select name=\"tipocons\" >"; 151 while(list($idtipo,$destipo)= mysql_fetch_row($res)){ 148 foreach($row as $res){ 149 $idtipo=$res['tipo_cons'];$destipo=$res['descrizione']; 152 150 if ($idtipo == $tipo_cons) { 153 151 $sel = "selected"; … … 180 178 ."<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._DATAFINE."</b></td>" 181 179 ."<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._FUNZIONI."</b></td></tr>"; 182 $res = mysql_query("SELECT * FROM ".$prefix."_ele_consultazione " , $dbi); 183 $max = mysql_num_rows($res); 184 $result = mysql_query("select * from ".$prefix."_ele_consultazione ORDER BY data_fine desc LIMIT $min,$offset", $dbi); 185 while(list($id, $descr_cons, $data_inizio, $data_fine,$tipo) = mysql_fetch_row($result)) { 180 $res = elenco_consultazioni(); 181 $max = count($res); 182 $sql="select * from ".$prefix."_ele_consultazione ORDER BY data_fine desc LIMIT $min,$offset"; 183 $sth = $dbi->prepare("$sql"); 184 $sth->execute(); 185 $row = $sth->fetchAll(); 186 foreach($row as $res) { 187 $id=$res['id_cons_gen']; $descr_cons=$res['descrizione']; $data_inizio=$res['data_inizio']; $data_fine=$res['data_fine'];$tipo=$res['tipo_cons']; 186 188 $data_inizio=form_data($data_inizio);$data_fine=form_data($data_fine); 187 189 $bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1']; … … 222 224 if ($perms>=128) { 223 225 if ($do == "delete") { 224 $result = mysql_query("delete from ".$prefix."_ele_rilaff where id_cons_gen='$id_cons_gen'", $dbi); 225 if (!$result) return; 226 $result = mysql_query("delete from ".$prefix."_ele_consultazione where id_cons_gen='$id_cons_gen'", $dbi); 227 if (!$result) return; 226 $sql="delete from ".$prefix."_ele_rilaff where id_cons_gen='$id_cons_gen'"; 227 $sth = $dbi->prepare("$sql"); 228 $sth->execute(); 229 $sql="delete from ".$prefix."_ele_consultazione where id_cons_gen='$id_cons_gen'"; 230 $sth = $dbi->prepare("$sql"); 231 $sth->execute(); 228 232 Header("Location: admin.php?op=consultazione"); 229 233 } … … 246 250 $data_fine="$dfa-$dfm-$dfg"; 247 251 $id_consulta=$id_cons_gen; 248 $result = mysql_query("insert into ".$prefix."_ele_consultazione (descrizione,data_inizio,data_fine,tipo_cons) values ('$descr_cons2','$data_inizio','$data_fine','$tipocons')", $dbi) || die("Errore di inserimento: ".mysql_error()); 249 /* $y=$result; 250 $res=mysql_query("select id_cons_gen from ".$prefix."_ele_consultazione where descrizione='$descr_cons2' 251 and data_inizio='$data_inizio' and data_fine='$data_fine' and tipo_cons='$tipocons'", $dbi); 252 list($idc)=mysql_fetch_row($res); 253 mkdir("images/consultazioni/$idc",0750); 254 copy("images/consultazioni/nulla.jpg","images/consultazioni/$idc/nulla.jpg");*/ 252 $sql="insert into ".$prefix."_ele_consultazione (descrizione,data_inizio,data_fine,tipo_cons) values ('$descr_cons2','$data_inizio','$data_fine','$tipocons')"; 253 $sth = $dbi->prepare("$sql"); 254 $sth->execute(); 255 255 256 } else { 256 257 OpenTable(); … … 262 263 $data_inizio="$dia-$dim-$dig"; 263 264 $data_fine="$dfa-$dfm-$dfg"; 264 $result = mysql_query("update ".$prefix."_ele_consultazione set descrizione='$descr_cons2',data_inizio='$data_inizio', 265 data_fine='$data_fine' WHERE id_cons_gen='$id_cons_gen'", $dbi); 265 $sql="update ".$prefix."_ele_consultazione set descrizione='$descr_cons2',data_inizio='$data_inizio',data_fine='$data_fine' WHERE id_cons_gen='$id_cons_gen'"; 266 $sth = $dbi->prepare("$sql"); 267 $sth->execute(); 266 268 if (!$result) return; 267 269 Header("Location: admin.php?op=consultazione&id_cons_gen=$id_cons_gen");
Note:
See TracChangeset
for help on using the changeset viewer.