Changeset 254 for trunk/admin/admin.php
- Timestamp:
- Mar 13, 2018, 9:26:23 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/admin.php
r253 r254 153 153 154 154 $row = $sth->fetch(PDO::FETCH_ASSOC); 155 # $res_config = mysql_query("select * from ".$prefix."_config ",$dbi); 156 # list ($sitename,$siteurl,$site_logo,$slogan,$startdate,$adminmail,$tema,$foot,$language,$blocco,$testata,$logo,$fileout,$copyright,$versione,$patch,$id_comune,$multicomune,$flash,$displayerrors,$editor,$tema_on,$ed_user) = ($res_config->fetch()); 157 $siteistat=$row['siteistat']; 155 $siteistat=$row['siteistat']; 158 156 if (!isset($_SESSION['id_comune'])){ 159 157 $_SESSION['sitename']=$row['sitename']; … … 182 180 $_SESSION['tema_on']=$tema_on; 183 181 $_SESSION['ed_user']=$ed_user; 184 } 182 } 185 183 //fine 186 184 if (isset($param['aid'])) { … … 198 196 // se superUserAdmin 199 197 ######## 200 $res_comune = mysql_query("select adminsuper from ".$prefix."_authors where aid='$aid' and pwd='$mpwd'",$dbi); 201 list ($adminsuper) = mysql_fetch_row($res_comune); 202 if ($adminsuper==1) $id_comune='0'; 198 $sth = $dbi->prepare("select adminsuper from ".$prefix."_authors where aid='$aid' and pwd='$mpwd'"); 199 $sth->execute(); 200 $row = $sth->fetch(PDO::FETCH_ASSOC); 201 $adminsuper=$row['adminsuper']; 202 if ($adminsuper==1) $id_comune='0'; 203 203 elseif (is_numeric($param['id_comune']) and intval($param['id_comune'])>0) $id_comune=intval($param['id_comune']); 204 $res= mysql_query("select counter,admlanguage from ".$prefix."_authors where aid='$aid' and pwd='$mpwd' and id_comune='$id_comune'", $dbi); 205 206 if ($res){ 207 $esiste=mysql_num_rows($res); 208 209 210 list ($counter,$tmplang) = mysql_fetch_row($res); 204 $sth = $dbi->prepare("select counter,admlanguage from ".$prefix."_authors where aid='$aid' and pwd='$mpwd' and id_comune='$id_comune'"); 205 $sth->execute(); 206 $row = $sth->fetch(PDO::FETCH_ASSOC); 207 208 if ($sth){ 209 $esiste=$sth->rowCount(); 210 $counter=$row['counter']; 211 $tmplang=$row['admlanguage']; 211 212 $counter+=1; 212 213 if(strlen($tmplang)==2) $language=$tmplang; 213 $resup=mysql_query("update ".$prefix."_authors set counter=$counter where aid='$aid' and pwd='$mpwd' and id_comune='$id_comune'", $dbi); 214 $sth = $dbi->prepare("update ".$prefix."_authors set counter=$counter where aid='$aid' and pwd='$mpwd' and id_comune='$id_comune'"); 215 $sth->execute(); 216 $row = $sth->fetch(PDO::FETCH_ASSOC); 217 214 218 if ($esiste==1) { 215 219 $_SESSION['dbi']=$dbi; … … 221 225 $_SESSION['remote']=$_SERVER['REMOTE_ADDR']; 222 226 $_SESSION['bgcolor1']='#ffffff'; 223 $_SESSION['bgcolor2']='#c5c5c5'; 227 $_SESSION['bgcolor2']='#c5c5c5'; if (!$op) $op='consultazione'; 224 228 session_regenerate_id(); 225 229 } … … 232 236 if (! isset($_SESSION['lang'])) $_SESSION['lang']=$language; 233 237 $currentlang=strlen($_SESSION['lang'])==2 ? $_SESSION['lang']: $language; 234 #if (isset($_SESSION['lang'])) $currentlang=$_SESSION['lang']; else $currentlang='it';235 238 if (isset($_SESSION['aid'])) 236 239 { … … 239 242 $dbi=$_SESSION['dbi']; 240 243 $prefix=$_SESSION['prefix']; 241 $id_comune=$_SESSION['id_comune']; die("qui");244 $id_comune=$_SESSION['id_comune']; 242 245 if (isset($_GET['id_cons_gen'])) $id_cons_gen=intval($_GET['id_cons_gen']); 243 246 else { 244 //10/05/2009 gestione consultazione predefinita 245 $result = mysql_query("select id_cons_gen from ".$prefix."_ele_cons_comune where preferita='1' and (id_comune='$id_comune' or id_comune=0)", $dbi);246 list($id_cons_gen) = mysql_fetch_row($result); 247 //---fine $id_cons_gen='';247 $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 $sth->execute(); 249 $row = $sth->fetch(PDO::FETCH_ASSOC); 250 $id_cons_gen=$row[1]; 248 251 } 249 252 $currentlang=$_SESSION['lang']; … … 262 265 function ChiSei($id_cons_gen){ 263 266 264 //$server=$_SERVER['REMOTE_ADDR']; 265 //$session=$_SESSION['remote']; 266 //if ($session!=$server) { die ("Problema di sessione"); }; 267 267 268 $aid=$_SESSION['aid']; 268 269 $dbi=$_SESSION['dbi']; … … 273 274 274 275 $perms=0; 275 $result = mysql_query("select adminsuper, admincomune, adminop from ".$prefix."_authors where aid='$aid' and pwd='$pwd' and (id_comune='$id_comune' or id_comune=0)", $dbi); 276 list($adminsuper,$admincomune,$adminop) = mysql_fetch_row($result); 277 //exit; 276 $sth = $dbi->prepare("select adminsuper, admincomune, adminop from ".$prefix."_authors where aid='$aid' and pwd='$pwd' and (id_comune='$id_comune' or id_comune=0)"); 277 $sth->execute(); 278 $row = $sth->fetch(PDO::FETCH_BOTH); 279 280 $adminsuper=$row[0]; 281 $admincomune=$row[1]; 282 $adminop=$row[2]; 283 278 284 if (($adminsuper==1 || $admincomune==1 || $adminop==1)) { 279 285 if ($adminsuper==1) 280 286 return 256; 281 // $ressup = mysql_query("select permessi from ".$prefix."_ele_operatori where id_cons='0' and aid='$aid' and id_comune='0'",$dbi); 282 elseif ($adminop==1) 283 $ressup = mysql_query("select permessi from ".$prefix."_ele_operatori where id_cons='0' and aid='$aid' and id_comune='$id_comune'",$dbi); 284 elseif ($admincomune==1) { 285 $res=mysql_query("select id_cons from ".$prefix."_ele_cons_comune where id_comune='$id_comune' and id_cons_gen='$id_cons_gen'",$dbi); 286 list ($id_cons)=mysql_fetch_row($res); 287 $ressup = mysql_query("select permessi from ".$prefix."_ele_operatori where id_cons='$id_cons' and aid='$aid' and id_comune='$id_comune'",$dbi); 287 elseif ($adminop==1){ 288 $sth = $dbi->prepare("select permessi from ".$prefix."_ele_operatori where id_cons='0' and aid='$aid' and id_comune='$id_comune'"); 289 }elseif ($admincomune==1) { 290 $sth = $dbi->prepare("select id_cons from ".$prefix."_ele_cons_comune where id_comune='$id_comune' and id_cons_gen='$id_cons_gen'"); 291 $sth->execute(); 292 $row = $sth->fetch(PDO::FETCH_BOTH); 293 294 $id_cons=$row[0]; 295 $sth = $dbi->prepare("select permessi from ".$prefix."_ele_operatori where id_cons='$id_cons' and aid='$aid' and id_comune='$id_comune'"); 288 296 } 289 if (mysql_num_rows($ressup)==1) list($perms)=mysql_fetch_row($ressup); else $perms=0; 297 298 $sth->execute(); 299 $row = $sth->fetch(PDO::FETCH_BOTH); 300 301 if ($sth->rowCount()==1) $perms=$row[0]; else $perms=0; 290 302 return $perms; 291 303 } else return 0; … … 540 552 include("modules/Elezioni/ele_riepilogo.php"); 541 553 break; 554 case "riepilogovoti": 555 include("modules/Elezioni/ele_riepilogovoti.php"); 556 break; 542 557 case "logout": 543 558 logout();
Note:
See TracChangeset
for help on using the changeset viewer.