Changeset 377 for trunk/admin
- Timestamp:
- Sep 28, 2022, 12:38:28 PM (2 years ago)
- Location:
- trunk/admin
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/admin.php
r376 r377 136 136 137 137 $dsn = "mysql:host=$dbhost"; 138 $opt = [ 139 PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, 140 PDO::ATTR_EMULATE_PREPARES => false, 141 ]; 138 $opt = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_EMULATE_PREPARES => false); 142 139 if($prefix == '') { 143 140 db_err ('stepBack','Non avete indicato il prefisso tabelle database.'); -
trunk/admin/aggiornadb.php
r376 r377 49 49 function aggiorna_index($tab,$ind,$dbi,$sql2,$num){ 50 50 $ret=0; 51 # $conn->getAttribute( constant( "PDO::ATTR_$val" ) ) 51 52 $sqltest="SHOW INDEX FROM `$tab` WHERE KEY_NAME = '$ind'"; 52 53 $res = $dbi->prepare("$sqltest"); 53 54 $res->execute(); 55 54 56 if($res->rowCount()) { 55 $sql="ALTER TABLE `$tab` DROP INDEX `$ind`"; 57 if($ind=='PRIMARY') 58 $sql="ALTER TABLE `$tab` DROP PRIMARY KEY , $sql2 "; 59 else 60 $sql="ALTER TABLE `$tab` DROP INDEX `$ind`"; 56 61 try{ 57 62 $res = $dbi->prepare("$sql"); … … 66 71 } 67 72 } 68 if("$sql2"!="" ){73 if("$sql2"!="" and $ind!='PRIMARY'){ 69 74 try{ 70 75 $res = $dbi->prepare("$sql2"); … … 242 247 $ret=aggiorna($sql,$dbi,'',$num); 243 248 249 echo "<br><br>".++$num.") Aggiornamento dei valori di default: ".$prefix."_ele_voti_lista"; 250 $sql="ALTER TABLE `".$prefix."_ele_voti_lista` CHANGE `num_lista` `num_lista` INT(2) UNSIGNED NULL DEFAULT '0';"; 251 $ret=aggiorna($sql,$dbi,'',$num); 252 244 253 echo "<br><br>".++$num.") Aggiornamento tabella ".$prefix."_ele_voti_lista"; 245 254 $sql="update `".$prefix."_ele_voti_lista` as t1 left join `".$prefix."_ele_lista` as t2 on t1.id_lista=t2.id_lista set t1.num_lista=t2.num_lista;"; … … 247 256 ############################################## 248 257 249 echo "<br><br>".++$num.") Aggiornamento dei valori di default ";258 echo "<br><br>".++$num.") Aggiornamento dei valori di default: ".$prefix."_ele_gruppo"; 250 259 $sql="ALTER TABLE `".$prefix."_ele_gruppo` CHANGE `num_circ` `num_circ` INT(2) UNSIGNED NOT NULL DEFAULT '1';"; 251 260 $ret=aggiorna($sql,$dbi,'',$num); … … 364 373 $ret=aggiorna_index($tab, $ind,$dbi,$sql2,$num); 365 374 375 $tab=$prefix."_ele_sezioni"; 376 $ind="id_cons"; 377 $sql2="ALTER TABLE `".$prefix."_ele_sezioni` ADD UNIQUE `id_cons` (`id_cons`, `num_sez`) USING BTREE"; 378 $ret=aggiorna_index($tab,$ind,$dbi,$sql2,$num); 379 366 380 $tab=$prefix."_ele_voti_lista"; 367 381 $ind="id_cons"; … … 390 404 $ind="PRIMARY"; 391 405 #$sql="ALTER TABLE `".$prefix."_ele_lista` DROP INDEX if exists `PRIMARY`"; 392 $sql2="A LTER TABLE `".$prefix."_ele_lista` ADD PRIMARY KEY (`id_lista`) USING BTREE";406 $sql2="ADD PRIMARY KEY (`id_lista`) USING BTREE"; 393 407 $ret=aggiorna_index($tab,$ind,$dbi,$sql2,$num); 394 408 … … 402 416 $ind="PRIMARY"; 403 417 #$sql="ALTER TABLE `".$prefix."_ele_gruppo` DROP INDEX if exists `PRIMARY`"; 404 $sql2="A LTER TABLE `".$prefix."_ele_gruppo` ADD PRIMARY KEY (`id_gruppo`) USING BTREE";418 $sql2="ADD PRIMARY KEY (`id_gruppo`) USING BTREE"; 405 419 $ret=aggiorna_index($tab,$ind,$dbi,$sql2,$num); 406 420 … … 414 428 $ind="PRIMARY"; 415 429 #$sql="ALTER TABLE `".$prefix."_ele_candidati` DROP INDEX if exists `PRIMARY`"; 416 $sql2="A LTER TABLE `".$prefix."_ele_candidati` ADD PRIMARY KEY (`id_cand`) USING BTREE";430 $sql2="ADD PRIMARY KEY (`id_cand`) USING BTREE"; 417 431 $ret=aggiorna_index($tab,$ind,$dbi,$sql2,$num); 418 432 -
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(); -
trunk/admin/versione.php
r376 r377 1 1 <?php 2 2 3 $versione = "3.0 rev 37 6";3 $versione = "3.0 rev 377"; 4 4 $version_number = $versione; 5 $datarel = "2 4settembre 2022";5 $datarel = "28 settembre 2022"; 6 6 $version = "Eleonline $version_number (<i>Data Release: $datarel</i>)"; 7 7
Note:
See TracChangeset
for help on using the changeset viewer.