Changeset 377 for trunk/admin/modules/Elezioni/ele_sezione.php
- Timestamp:
- Sep 28, 2022, 12:38:28 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/modules/Elezioni/ele_sezione.php
r344 r377 23 23 list($tipo_cons,$id_cons) = $res->fetch(PDO::FETCH_NUM); 24 24 if (isset($param['do'])) $do=addslashes($param['do']); else $do=''; 25 if (isset($param['mex'])) $mex=addslashes($param['mex']); else $mex=''; 25 26 if (isset($param['id_sede'])) $id_sede=intval($param['id_sede']); else $id_sede=''; 26 27 if (isset($param['min'])) $min=intval($param['min']); else $min=0; … … 46 47 47 48 function all() { 48 global $admin, $bgcolor1, $bgcolor2, $prefix, $dbi, $offset, $min, $id_cons,$id_cons_gen;49 global $admin, $bgcolor1, $bgcolor2, $prefix, $dbi, $offset, $min, $id_cons,$id_cons_gen,$mex; 49 50 # OpenTable(); 50 51 $y=0; 51 echo "<center><font class=\"title\"><a NAME=riga><b>"._SEZIONE."</b></a></font><br><br><table border=\"0\" width=\"95%\"><tr>" 52 $sql="SELECT * FROM ".$prefix."_ele_sezioni where id_cons='$id_cons' "; 53 $res = $dbi->prepare("$sql"); 54 $res->execute(); 55 $numsez = $res->rowCount(); 56 $sql="SELECT max(num_sez) FROM ".$prefix."_ele_sezioni where id_cons='$id_cons' "; 57 $res = $dbi->prepare("$sql"); 58 $res->execute(); 59 list($max) = $res->fetch(PDO::FETCH_NUM); 60 if($numsez!=$max) $mex="Sembra che sia stata saltata una sezione, controllate prego"; 61 echo "<center><font class=\"title\"><a NAME=riga><b>"._SEZIONE."</b></a></font><br>"; 62 if($mex!='') 63 echo "<h2 style=\"background-color:red;color:white;\">$mex</h2>"; 64 echo "<br><table border=\"0\" width=\"95%\"><tr>" 52 65 ."<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._NUM."</b></td>" 53 66 ."<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._INDIRIZZO."</b></td>" … … 56 69 ."<td bgcolor=\"$bgcolor1\" align=\"center\" ><b>"._TOTS." "._ISCRITTI."</b></td>" 57 70 ."<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._FUNZIONI."</b></td></tr>"; 58 $sql="SELECT * FROM ".$prefix."_ele_sezioni where id_cons='$id_cons' ";59 $res = $dbi->prepare("$sql");60 $res->execute();61 $max = $res->rowCount();62 71 echo "<tr align=\"center\"><form name=\"sezi\" action=\"admin.php\">" 63 72 ."<input type=\"hidden\" name=\"op\" value=\"sezione\">" … … 217 226 $sql="insert into ".$prefix."_ele_sezioni (id_cons,id_sede,num_sez,maschi,femmine, autorizzati_m,autorizzati_f,colore) values ('$id_cons', '$id_sede', '$num_sez','$maschi','$femmine','$aut_m', '$aut_f','#FAFAD2')"; 218 227 $res = $dbi->prepare("$sql"); 219 $res->execute(); 220 Header("Location: admin.php?op=sezione&id_cons_gen=$id_cons_gen&min=$min"); 228 $mex=''; 229 try 230 { 231 $res->execute(); 232 } 233 catch(PDOException $e) 234 { 235 if ($e->errorInfo[1] == 1062) $mex="Numero di sezione duplicato, dati non memorizzati"; 236 } 237 Header("Location: admin.php?op=sezione&id_cons_gen=$id_cons_gen&min=$min&mex=$mex"); 221 238 } else { 222 239 ele();
Note:
See TracChangeset
for help on using the changeset viewer.