Changeset 383 for trunk/admin/modules/Elezioni/ele_lista.php
- Timestamp:
- Nov 15, 2022, 4:26:53 PM (18 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/modules/Elezioni/ele_lista.php
r360 r383 217 217 218 218 function lista($ok, $do,$id_lista, $num_lista, $id_gruppo,$id_circ, $descr_lista, $simbolo,$stemma) { 219 global $param,$bgcolor1, $bgcolor2, $prefix, $dbi, $descr_cons, $id_cons,$simbolo2,$tipo_cons,$min,$genere,$id_cons_gen; 220 $aid=$_SESSION['aid']; 221 $perms=ChiSei($id_cons_gen); 222 if (!$id_gruppo) $id_gruppo=0; 223 if ($perms >16) { 224 if ($do == "delete") { 225 if ($ok !="1") { 226 ele(); 227 echo "<center><br><br>"._DOMCANCELLA." "._LISTA." $descr_lista ?<br>"; 228 echo "[ <a href=\"admin.php?op=lista&id_cons_gen=$id_cons_gen&min=$min&id_circ=$id_circ\">"._NO."</a> ] - [<a href=\"admin.php?op=lista&do=delete&id_lista=$id_lista&id_gruppo=$id_gruppo&id_circ=$id_circ&ok=1&min=$min&id_cons_gen=$id_cons_gen\">"._YES."</a> ]";exit; 229 }else{ 230 $sql="delete from ".$prefix."_ele_lista where id_lista='$id_lista'"; 231 $result = $dbi->prepare("$sql"); 232 $result->execute(); 233 Header("Location: admin.php?op=lista&id_circ=$id_circ&id_cons_gen=$id_cons_gen&min=$min"); 234 } 235 }elseif ($do == "add") { 236 if ($descr_lista and ($id_gruppo or ($genere!=3 and $genere!=5))) { 219 global $param,$bgcolor1, $bgcolor2, $prefix, $dbi, $descr_cons, $id_cons,$simbolo2,$tipo_cons,$min,$genere,$id_cons_gen; 220 $aid=$_SESSION['aid']; 221 $perms=ChiSei($id_cons_gen); 222 if (!$id_gruppo) $id_gruppo=0; 223 $sql="select num_gruppo from ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'"; 224 $result1 = $dbi->prepare("$sql"); 225 $result1->execute(); 226 list($num_gruppo)=$result1->fetch(PDO::FETCH_NUM); 227 if ($perms >16) { 228 if ($do == "delete") { 229 if ($ok !="1") { 230 ele(); 231 echo "<center><br><br>"._DOMCANCELLA." "._LISTA." $descr_lista ?<br>"; 232 echo "[ <a href=\"admin.php?op=lista&id_cons_gen=$id_cons_gen&min=$min&id_circ=$id_circ\">"._NO."</a> ] - [<a href=\"admin.php?op=lista&do=delete&id_lista=$id_lista&id_gruppo=$id_gruppo&id_circ=$id_circ&ok=1&min=$min&id_cons_gen=$id_cons_gen\">"._YES."</a> ]";exit; 233 }else{ 234 $sql="delete from ".$prefix."_ele_lista where id_lista='$id_lista'"; 235 $result = $dbi->prepare("$sql"); 236 $result->execute(); 237 Header("Location: admin.php?op=lista&id_circ=$id_circ&id_cons_gen=$id_cons_gen&min=$min"); 238 } 239 }elseif ($do == "add") { 240 if ($descr_lista and ($id_gruppo or ($genere!=3 and $genere!=5))) { 241 $stemmablob=''; 242 $stemmanome=''; 243 $STEMM=$_FILES['stemma']; 244 $filestemma=$STEMM['tmp_name']; 245 $nomestemma=$STEMM['name']; 246 $sqlset=''; 247 if ($filestemma){ 248 $fdstemma = fopen ("$filestemma", "rb"); 249 $stemmacontents = fread ($fdstemma, filesize ("$filestemma")); 250 fclose ($fdstemma); 251 $stemmablob=addslashes($stemmacontents); 252 $stemmanome=addslashes($nomestemma); 253 } 254 $sql="insert into ".$prefix."_ele_lista (id_cons,num_lista,id_gruppo,num_gruppo,id_circ,descrizione,simbolo,stemma) values ('$id_cons','$num_lista','$id_gruppo','$num_gruppo','$id_circ','$descr_lista','$stemmanome','$stemmablob')"; 255 $result = $dbi->prepare("$sql"); 256 $result->execute(); 257 Header("Location: admin.php?op=lista&id_circ=$id_circ&min=$min&id_cons_gen=$id_cons_gen"); 258 } else { 259 $mex=""; 260 if (!$id_gruppo) $mex.="- Devi collegare la lista ad un gruppo! -"; 261 if (!$descr_lista) $mex.="- Devi inserire il nome della lista! -"; 262 Header("Location: admin.php?op=lista&id_circ=$id_circ&min=$min&id_cons_gen=$id_cons_gen&descr_lista=$descr_lista&id_gruppo=$id_gruppo&mex=$mex"); 263 } 264 }elseif ($do == "update") { 237 265 $stemmablob=''; 238 266 $stemmanome=''; … … 242 270 $sqlset=''; 243 271 if ($filestemma){ 244 $fdstemma = fopen ("$filestemma", "rb"); 245 $stemmacontents = fread ($fdstemma, filesize ("$filestemma")); 246 fclose ($fdstemma); 247 $stemmablob=addslashes($stemmacontents); 248 $stemmanome=addslashes($nomestemma); 249 } 250 $sql="insert into ".$prefix."_ele_lista (id_cons,num_lista,id_gruppo,id_circ,descrizione,simbolo,stemma) values ('$id_cons','$num_lista','$id_gruppo','$id_circ','$descr_lista','$stemmanome','$stemmablob')"; 272 $fdstemma = fopen ("$filestemma", "rb"); 273 $stemmacontents = fread ($fdstemma, filesize ("$filestemma")); 274 fclose ($fdstemma); 275 $stemmablob=addslashes($stemmacontents); 276 $stemmanome=($nomestemma); 277 $cond=", simbolo='$stemmanome', stemma='$stemmablob'"; 278 } else {$cond='';} 279 $sql="update ".$prefix."_ele_lista set num_lista='$num_lista' , id_gruppo='$id_gruppo',num_gruppo='$num_gruppo',descrizione='$descr_lista' $cond where id_lista='$id_lista'"; 280 #die("TEST: $sql"); 251 281 $result = $dbi->prepare("$sql"); 252 282 $result->execute(); 253 283 Header("Location: admin.php?op=lista&id_circ=$id_circ&min=$min&id_cons_gen=$id_cons_gen"); 254 } else { 255 $mex=""; 256 if (!$id_gruppo) $mex.="- Devi collegare la lista ad un gruppo! -"; 257 if (!$descr_lista) $mex.="- Devi inserire il nome della lista! -"; 258 Header("Location: admin.php?op=lista&id_circ=$id_circ&min=$min&id_cons_gen=$id_cons_gen&descr_lista=$descr_lista&id_gruppo=$id_gruppo&mex=$mex"); 259 } 260 }elseif ($do == "update") { 261 $stemmablob=''; 262 $stemmanome=''; 263 $STEMM=$_FILES['stemma']; 264 $filestemma=$STEMM['tmp_name']; 265 $nomestemma=$STEMM['name']; 266 $sqlset=''; 267 if ($filestemma){ 268 $fdstemma = fopen ("$filestemma", "rb"); 269 $stemmacontents = fread ($fdstemma, filesize ("$filestemma")); 270 fclose ($fdstemma); 271 $stemmablob=addslashes($stemmacontents); 272 $stemmanome=($nomestemma); 273 $cond=", simbolo='$stemmanome', stemma='$stemmablob'"; 274 } else {$cond='';} 275 $sql="update ".$prefix."_ele_lista set num_lista='$num_lista' , id_gruppo='$id_gruppo',descrizione='$descr_lista' $cond where id_lista='$id_lista'"; 276 #die("TEST: $sql"); 277 $result = $dbi->prepare("$sql"); 278 $result->execute(); 279 Header("Location: admin.php?op=lista&id_circ=$id_circ&min=$min&id_cons_gen=$id_cons_gen"); 280 } 281 282 283 } 284 } 285 286 287 } 284 288 } 285 289
Note:
See TracChangeset
for help on using the changeset viewer.