[2] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | /************************************************************************/
|
---|
| 4 | /* Eleonline - Raccolta e diffusione dei dati elettorali */
|
---|
| 5 | /* by Roberto Gigli & Luciano Apolito */
|
---|
| 6 | /* http://www.eleonline.it */
|
---|
| 7 | /* info@eleonline.it luciano@aniene.net rgigli@libero.it */
|
---|
| 8 | /************************************************************************/
|
---|
| 9 | /* Admin */
|
---|
| 10 | /* Amministrazione */
|
---|
| 11 | /************************************************************************/
|
---|
| 12 |
|
---|
| 13 | /* Descrizione file admin.php =
|
---|
| 14 | effettua il login o il rilancio alla gestione */
|
---|
| 15 |
|
---|
| 16 | define('ADMIN_FILE', true);
|
---|
| 17 | #$LIMITE=3; //fascia di separazione del maggioritario (15.000 abitanti)
|
---|
[35] | 18 | # tempo di sessione: ini_set('session.gc_maxlifetime','3600');
|
---|
[358] | 19 | global $multicomune,$msglogout;
|
---|
[2] | 20 |
|
---|
| 21 | // Adattamento variabili superglobal
|
---|
| 22 | // Versione di php
|
---|
| 23 | $phpver = phpversion();
|
---|
[255] | 24 | global $dbi;
|
---|
[2] | 25 | // converte superglobal se php e' < 4.1.0
|
---|
| 26 |
|
---|
| 27 | if ($phpver < '4.1.0') {
|
---|
| 28 | $_GET = $HTTP_GET_VARS;
|
---|
| 29 | $_POST = $HTTP_POST_VARS;
|
---|
| 30 | $_SERVER = $HTTP_SERVER_VARS;
|
---|
| 31 | $_FILES = $HTTP_POST_FILES;
|
---|
| 32 | $_ENV = $HTTP_ENV_VARS;
|
---|
| 33 | if($_SERVER['REQUEST_METHOD'] == "POST") {
|
---|
| 34 | $_REQUEST = $_POST;
|
---|
| 35 | } elseif($_SERVER['REQUEST_METHOD'] == "GET") {
|
---|
| 36 | $_REQUEST = $_GET;
|
---|
| 37 | }
|
---|
| 38 | if(isset($HTTP_COOKIE_VARS)) {
|
---|
| 39 | $_COOKIE = $HTTP_COOKIE_VARS;
|
---|
| 40 | }
|
---|
| 41 | if(isset($HTTP_SESSION_VARS)) {
|
---|
| 42 | $_SESSION = $HTTP_SESSION_VARS;
|
---|
| 43 | }
|
---|
| 44 | }
|
---|
| 45 |
|
---|
| 46 | $param=strtolower($_SERVER['REQUEST_METHOD']) == 'get' ? $_GET : $_POST;
|
---|
[344] | 47 | if (isset($param['aid'])) $aid=addslashes($param['aid']); else $aid='';
|
---|
[358] | 48 | if (isset($param['pwd'])) $pwd2=addslashes($param['pwd']); else $pwd2='';
|
---|
| 49 | if(isset($param['msglogout'])) $msglogout=intval($param['msglogout']); else $msglogout=0;
|
---|
| 50 |
|
---|
[2] | 51 | // Additional security (Union, CLike, XSS)
|
---|
| 52 |
|
---|
| 53 | // We want to use the function stripos,
|
---|
| 54 | // but thats only available since PHP5.
|
---|
| 55 | // So we cloned the function...
|
---|
| 56 | if(!function_exists('stripos')) {
|
---|
| 57 | function stripos_clone($haystack, $needle, $offset=0) {
|
---|
| 58 | return strpos(strtoupper($haystack), strtoupper($needle), $offset);
|
---|
| 59 | }
|
---|
| 60 | } else {
|
---|
| 61 | // But when this is PHP5, we use the original function
|
---|
| 62 | function stripos_clone($haystack, $needle, $offset=0) {
|
---|
| 63 | return stripos($haystack, $needle, $offset=0);
|
---|
| 64 | }
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | if(isset($_SERVER['QUERY_STRING']) && (!stripos_clone($_SERVER['QUERY_STRING'], "ad_click") || !stripos_clone($_SERVER['QUERY_STRING'], "url"))) {
|
---|
| 68 | $queryString = $_SERVER['QUERY_STRING'];
|
---|
| 69 | if (stripos_clone($queryString,'%20union%20') OR stripos_clone($queryString,'/*') OR stripos_clone($queryString,'*/union/*') OR stripos_clone($queryString,'c2nyaxb0') OR stripos_clone($queryString,'+union+') OR stripos_clone($queryString,'http://') OR (stripos_clone($queryString,'cmd=') AND !stripos_clone($queryString,'&cmd')) OR (stripos_clone($queryString,'exec') AND !stripos_clone($queryString,'execu')) OR stripos_clone($queryString,'concat')) {
|
---|
| 70 | die('Operazione non consentita');
|
---|
| 71 | }
|
---|
| 72 | }
|
---|
| 73 |
|
---|
| 74 |
|
---|
| 75 | foreach ($_GET as $sec_key => $secvalue) {
|
---|
[21] | 76 | if ((preg_match("/<[^>]*script*\"?[^>]*>/i",$secvalue)) ||
|
---|
| 77 | (preg_match("/<[^>]*object*\"?[^>]*>/i", $secvalue)) ||
|
---|
| 78 | (preg_match("/<[^>]*iframe*\"?[^>]*>/i", $secvalue)) ||
|
---|
| 79 | (preg_match("/<[^>]*applet*\"?[^>]*>/i", $secvalue)) ||
|
---|
| 80 | (preg_match("/<[^>]*meta*\"?[^>]*>/i", $secvalue)) ||
|
---|
| 81 | (preg_match("/<[^>]*style*\"?[^>]*>/i", $secvalue)) ||
|
---|
| 82 | (preg_match("/<[^>]*form*\"?[^>]*>/i", $secvalue)) ||
|
---|
| 83 | (preg_match("/<[^>]*img*\"?[^>]*>/i", $secvalue)) ||
|
---|
| 84 | (preg_match("/<[^>]*onmouseover*\"?[^>]*>/i", $secvalue)) ||
|
---|
| 85 | (preg_match("/<[^>]*body*\"?[^>]*>/i", $secvalue)) ||
|
---|
| 86 | (preg_match("/\"/", $secvalue)) ||
|
---|
| 87 | (preg_match("/inside_mod/i", $sec_key))) {
|
---|
[2] | 88 | die ("Operazione non consentita");
|
---|
| 89 | }
|
---|
| 90 | }
|
---|
| 91 |
|
---|
| 92 | foreach ($_POST as $secvalue) {
|
---|
[21] | 93 | if ((preg_match("/<[^>]*onmouseover*\"?[^>]*>/i", $secvalue)) || (preg_match("/<[^>]script*\"?[^>]*>/i", $secvalue)) || (preg_match("/<[^>]*body*\"?[^>]*>/i", $secvalue)) || (preg_match("/<[^>]style*\"?[^>]*>/i", $secvalue))) {
|
---|
[2] | 94 | die ('Operazione non consentita');
|
---|
| 95 | }
|
---|
| 96 | }
|
---|
| 97 |
|
---|
| 98 | // Posting from other servers in not allowed
|
---|
| 99 | // Fix by Quake
|
---|
| 100 | // Bug found by PeNdEjO
|
---|
| 101 |
|
---|
| 102 | if ($_SERVER['REQUEST_METHOD'] == "POST") {
|
---|
| 103 | if (isset($_SERVER['HTTP_REFERER'])) {
|
---|
| 104 | if (!stripos_clone($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])) {
|
---|
| 105 | die('Posting da un altro server non consentito!');
|
---|
| 106 | }
|
---|
| 107 | } else {
|
---|
| 108 | # die('<b>Attenzione:</b> il tuo browser non puo inviare gli header HTTP_REFERER al website.<br>'.$_SERVER['HTTP_REFERER']);
|
---|
| 109 | }
|
---|
| 110 | }
|
---|
| 111 |
|
---|
| 112 |
|
---|
| 113 |
|
---|
| 114 |
|
---|
| 115 |
|
---|
| 116 |
|
---|
| 117 |
|
---|
| 118 | //===================================================================
|
---|
| 119 | session_name('sesadmin');
|
---|
[255] | 120 | #session_start();//MODIFICHE PER GESTIONE SESSIONI
|
---|
[2] | 121 | // gestione sessione
|
---|
[255] | 122 | $a = session_id();
|
---|
| 123 | if(empty($a)) session_start();
|
---|
| 124 | #echo "SID: ".SID."<br>session_id(): ".session_id()."<br>COOKIE: ".$_COOKIE["PHPSESSID"];
|
---|
[2] | 125 |
|
---|
[246] | 126 | if (file_exists("config.php")){
|
---|
| 127 | $install="0"; @require_once("config.php");
|
---|
| 128 | }else{
|
---|
| 129 | $install="1";
|
---|
| 130 | }
|
---|
[2] | 131 |
|
---|
[154] | 132 | # verifica se effettuata la configurazione
|
---|
[246] | 133 | if(empty($dbname) || $install=="1") {
|
---|
[230] | 134 | die("<html><body><div style=\"text-align:center\"><br /><br /><img src=\"modules/Elezioni/images/logo.jpg\" alt=\"Eleonline\" title=\"Eleonline\"><br /><br /><strong>Sembra che <a href='http://www.eleonline.it' title='Eleonline'>Eleonline</a> non sia stato ancora installato.<br /><br />Puoi procedere <a href='../install/index.php'>cliccando qui</a> per iniziare l'installazione</strong></div></body></html>");
|
---|
[154] | 135 | }
|
---|
[2] | 136 |
|
---|
[154] | 137 |
|
---|
| 138 |
|
---|
| 139 |
|
---|
[253] | 140 | try{
|
---|
| 141 | $dbi = new PDO("mysql:host=$dbhost;charset=latin1", $dbuname, $dbpass, array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION));
|
---|
| 142 | $sql = "use $dbname";
|
---|
| 143 | $dbi->exec($sql);
|
---|
| 144 | }
|
---|
| 145 | catch(PDOException $e)
|
---|
| 146 | {
|
---|
| 147 | echo $sql . "<br>" . $e->getMessage();
|
---|
| 148 | }
|
---|
[154] | 149 |
|
---|
| 150 |
|
---|
[253] | 151 | # $dbi=mysql_connect($dbhost, $dbuname, $dbpass) or die("Connessione non riuscita: " . mysql_error());
|
---|
| 152 | # mysql_select_db($dbname)or die("Connessione non riuscita:" . mysql_error());
|
---|
| 153 | ## mysql_query("SET NAMES 'utf8'", $dbi);
|
---|
[2] | 154 | //---10/05/2009 gestione consultazione predefinita
|
---|
[253] | 155 | $sth = $dbi->prepare("select * from ".$prefix."_config");
|
---|
| 156 | $sth->execute();
|
---|
[255] | 157 | $row = $sth->fetch(PDO::FETCH_ASSOC);
|
---|
| 158 | #$row = $sth->fetchAll();
|
---|
[254] | 159 | $siteistat=$row['siteistat'];
|
---|
[2] | 160 | if (!isset($_SESSION['id_comune'])){
|
---|
[253] | 161 | $_SESSION['sitename']=$row['sitename'];
|
---|
| 162 | $_SESSION['siteurl']=$row['siteurl'];
|
---|
| 163 | $_SESSION['site_logo']=$row['site_logo'];
|
---|
| 164 | $_SESSION['slogan']=$row['slogan'];
|
---|
| 165 | $_SESSION['startdate']=$row['startdate'];
|
---|
| 166 | $_SESSION['adminmail']=$row['adminmail'];
|
---|
[358] | 167 | # if (isset($tema) and $tema=='facebook')
|
---|
| 168 | # $_SESSION['tema']=$row['tema'];
|
---|
[253] | 169 | $_SESSION['foot']=$row['foot'];
|
---|
| 170 | $_SESSION['lang']=$row['language'];
|
---|
| 171 | $_SESSION['blocco']=$row['blocco'];
|
---|
| 172 | $_SESSION['testata']=$row['testata'];
|
---|
[255] | 173 | # $_SESSION['logo']=$row['logo'];
|
---|
[253] | 174 | $_SESSION['fileout']=$row['fileout'];
|
---|
| 175 | $_SESSION['copyright']=$row['copyright'];
|
---|
| 176 | $_SESSION['versione']=$row['versione'];
|
---|
| 177 | $_SESSION['patch']=$row['patch'];
|
---|
| 178 | $_SESSION['id_comune']=$row['siteistat'];
|
---|
[255] | 179 | $_SESSION['multicomune']=$row['multicomune'];
|
---|
| 180 | $_SESSION['flash']=$row['flash'];
|
---|
| 181 | $_SESSION['displayerrors']=$row['displayerrors'];
|
---|
| 182 | $_SESSION['editor']=$row['editor'];
|
---|
| 183 | $_SESSION['tema_on']=$row['tema_on'];
|
---|
| 184 | $_SESSION['ed_user']=$row['ed_user'];
|
---|
[332] | 185 | $multicomune=$row['multicomune'];
|
---|
[254] | 186 | }
|
---|
[2] | 187 | //fine
|
---|
[358] | 188 | if (isset($param['tema'])) $_SESSION['tema']=$param['tema'];
|
---|
| 189 | if (!isset($_SESSION['tema']))
|
---|
| 190 | $_SESSION['tema']='default';
|
---|
| 191 | $tema=$_SESSION['tema'];
|
---|
| 192 |
|
---|
[2] | 193 | if (isset($param['aid'])) {
|
---|
[358] | 194 | if (strlen($aid)>25 ) { die ("Nome utente troppo lungo: $aid"); }
|
---|
[2] | 195 | if (!isset($param['id_ses']) or $param['id_ses'] != session_id()) logout();
|
---|
[21] | 196 | if (strstr( $aid," ")) { die ("Gli spazi non sono ammessi nel nome utente: $aid"); }
|
---|
[358] | 197 | if (isset($_SESSION['aid'])){
|
---|
[2] | 198 | logout();//se hai gia' una sessione aperta non puoi postare 'aid'
|
---|
| 199 | }else{
|
---|
| 200 |
|
---|
[358] | 201 | // $pwd2=$param['pwd'];
|
---|
| 202 | $mpwd=md5($pwd2);
|
---|
[2] | 203 |
|
---|
[358] | 204 | // se superUserAdmin
|
---|
| 205 | ########
|
---|
| 206 | # $sth = $dbi->prepare("select adminsuper from ".$prefix."_authors where aid='$aid' and pwd='$mpwd'");
|
---|
| 207 | # $sth->execute();
|
---|
| 208 | # $row = $sth->fetch(PDO::FETCH_ASSOC);
|
---|
| 209 | if (isset($param['id_comune']) and intval($param['id_comune'])>0) $id_comune=intval($param['id_comune']); else $id_comune=0;;
|
---|
| 210 | # if ($adminsuper==1) $id_comune2=0; else
|
---|
| 211 | $id_comune2=$id_comune;
|
---|
| 212 | $sth = $dbi->prepare("select pwd,adminop,adminsuper,counter,admlanguage from ".$prefix."_authors where aid='$aid' and (id_comune='$id_comune2' or adminsuper='1')");
|
---|
| 213 | $sth->execute();
|
---|
| 214 | $esiste=$sth->rowCount();
|
---|
| 215 | # $adminsuper=$row['adminsuper'];
|
---|
| 216 | $row = $sth->fetch(PDO::FETCH_ASSOC);
|
---|
| 217 | if(!$esiste) {
|
---|
| 218 | $msglogout=2;
|
---|
| 219 | logout();
|
---|
| 220 | }else{
|
---|
| 221 | if ($row['pwd']!=$mpwd) {
|
---|
| 222 | $msglogout=3;
|
---|
| 223 | logout();
|
---|
| 224 | }elseif($row['adminop']==1) {
|
---|
| 225 | $msglogout=1;
|
---|
| 226 | logout();
|
---|
| 227 | }
|
---|
[254] | 228 | $counter=$row['counter'];
|
---|
| 229 | $tmplang=$row['admlanguage'];
|
---|
[2] | 230 | if(strlen($tmplang)==2) $language=$tmplang;
|
---|
[358] | 231 | $sth = $dbi->prepare("update ".$prefix."_authors set counter=$counter where aid='$aid' and pwd='$mpwd' and id_comune='$id_comune2'");
|
---|
[254] | 232 | $sth->execute();
|
---|
[358] | 233 | # $row = $sth->fetch(PDO::FETCH_ASSOC);
|
---|
[2] | 234 | if ($esiste==1) {
|
---|
[255] | 235 | # $_SESSION['dbi']=$dbi;
|
---|
[2] | 236 | $_SESSION['aid']="$aid";
|
---|
| 237 | $_SESSION['pwd']="$mpwd";
|
---|
| 238 | $_SESSION['lang']="$language";
|
---|
| 239 | $_SESSION['id_comune']="$id_comune";
|
---|
| 240 | $_SESSION['prefix']="soraldo";
|
---|
| 241 | $_SESSION['remote']=$_SERVER['REMOTE_ADDR'];
|
---|
| 242 | $_SESSION['bgcolor1']='#ffffff';
|
---|
[269] | 243 | $_SESSION['bgcolor2']='#c5c5c5';
|
---|
| 244 | if (!isset($op)) $op='consultazione';
|
---|
[2] | 245 | session_regenerate_id();
|
---|
| 246 | }
|
---|
| 247 | }
|
---|
| 248 | }
|
---|
| 249 | }else{
|
---|
[255] | 250 | #$_SESSION['dbi']=$dbi;
|
---|
[2] | 251 |
|
---|
[255] | 252 | }
|
---|
[358] | 253 | if(!isset($_SESSION['BASE'])) $_SESSION['BASE']=substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['REQUEST_URI'], "/")-16);
|
---|
| 254 | if(!isset($language)) $language=$_SESSION['lang'];
|
---|
[2] | 255 | if (! isset($_SESSION['lang'])) $_SESSION['lang']=$language;
|
---|
| 256 | $currentlang=strlen($_SESSION['lang'])==2 ? $_SESSION['lang']: $language;
|
---|
[358] | 257 |
|
---|
| 258 | if (isset($_SESSION['aid']))
|
---|
[2] | 259 | {
|
---|
| 260 | //lettura sessione
|
---|
| 261 | $aid=$_SESSION['aid'];
|
---|
[255] | 262 | #$dbi=$_SESSION['dbi'];
|
---|
[2] | 263 | $prefix=$_SESSION['prefix'];
|
---|
[254] | 264 | $id_comune=$_SESSION['id_comune'];
|
---|
[358] | 265 | if($id_comune==0) $rifcomune='58047'; else $rifcomune=$id_comune;
|
---|
[2] | 266 | if (isset($_GET['id_cons_gen'])) $id_cons_gen=intval($_GET['id_cons_gen']);
|
---|
| 267 | else {
|
---|
[358] | 268 | $sql="SELECT t1.id_cons_gen FROM ".$prefix."_ele_cons_comune as t1, ".$prefix."_ele_comuni as t2 where t1.id_cons=t2.id_cons and t2.id_comune='$id_comune'";
|
---|
| 269 | $sth = $dbi->prepare($sql);
|
---|
[254] | 270 | $sth->execute();
|
---|
[336] | 271 | $row = $sth->fetch(PDO::FETCH_BOTH);
|
---|
| 272 | if($sth->rowCount())
|
---|
| 273 | $id_cons_gen=$row[0];
|
---|
| 274 | else
|
---|
[358] | 275 | $id_cons_gen=0; #die("TEST IN CORSO : idconsgen: $id_cons_gen -- sql:select id_cons_gen from ".$prefix."_ele_cons_comune where preferita='1' and (id_comune='$id_comune' or id_comune=0)");
|
---|
[2] | 276 | }
|
---|
| 277 | $currentlang=$_SESSION['lang'];
|
---|
[358] | 278 | #$bgcolor1=$_SESSION['bgcolor1'];
|
---|
[2] | 279 | $bgcolor2=$_SESSION['bgcolor2'];
|
---|
| 280 | $bgcolor1='#e7e7e7';
|
---|
| 281 | $session=$_SESSION['remote'];
|
---|
| 282 |
|
---|
| 283 | $perms=ChiSei($id_cons_gen);
|
---|
[358] | 284 | if($perms==0) logout();
|
---|
[2] | 285 | }
|
---|
| 286 |
|
---|
| 287 |
|
---|
| 288 | /*********************************************************/
|
---|
| 289 | /* Login Function */
|
---|
| 290 | /*********************************************************/
|
---|
| 291 | function ChiSei($id_cons_gen){
|
---|
[358] | 292 | global $dbi, $msglogout;
|
---|
[2] | 293 |
|
---|
| 294 | $aid=$_SESSION['aid'];
|
---|
| 295 | $prefix=$_SESSION['prefix'];
|
---|
| 296 | $pwd=$_SESSION['pwd'];
|
---|
| 297 | $id_comune=$_SESSION['id_comune'];
|
---|
| 298 |
|
---|
| 299 |
|
---|
| 300 | $perms=0;
|
---|
[257] | 301 | $sql="select adminsuper, admincomune, adminop from ".$prefix."_authors where aid='$aid' and pwd='$pwd' and (id_comune='$id_comune' or id_comune=0)";
|
---|
| 302 | $sth = $dbi->prepare("$sql");
|
---|
| 303 | $sth->execute();
|
---|
| 304 | $row = $sth->fetch(PDO::FETCH_BOTH);
|
---|
[254] | 305 |
|
---|
| 306 | $adminsuper=$row[0];
|
---|
| 307 | $admincomune=$row[1];
|
---|
| 308 | $adminop=$row[2];
|
---|
| 309 |
|
---|
[358] | 310 | #if (($adminsuper==1 || $admincomune==1 || $adminop==1)) {
|
---|
[2] | 311 | if ($adminsuper==1)
|
---|
| 312 | return 256;
|
---|
[358] | 313 | elseif ($admincomune==1){
|
---|
| 314 | return 64;
|
---|
| 315 | # $sth = $dbi->prepare("select permessi from ".$prefix."_ele_operatori where id_cons='0' and aid='$aid' and id_comune='$id_comune'");
|
---|
| 316 | }else{
|
---|
[254] | 317 | $sth = $dbi->prepare("select id_cons from ".$prefix."_ele_cons_comune where id_comune='$id_comune' and id_cons_gen='$id_cons_gen'");
|
---|
[358] | 318 | $sth->execute();
|
---|
| 319 | $row = $sth->fetch(PDO::FETCH_BOTH);
|
---|
| 320 | $id_cons=$row[0];
|
---|
[254] | 321 | $sth = $dbi->prepare("select permessi from ".$prefix."_ele_operatori where id_cons='$id_cons' and aid='$aid' and id_comune='$id_comune'");
|
---|
[358] | 322 | }
|
---|
| 323 | $sth->execute();
|
---|
| 324 | $row = $sth->fetch(PDO::FETCH_BOTH);
|
---|
| 325 | if($row[0]==0) $msglogout=1;
|
---|
| 326 | if ($sth->rowCount()==1) $perms=$row[0]; else { $msglogout=1; $perms=0; }
|
---|
[2] | 327 | return $perms;
|
---|
[358] | 328 | #} else return 0;
|
---|
[2] | 329 | }
|
---|
| 330 |
|
---|
| 331 | function OpenTable(){
|
---|
| 332 | echo "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"2\" BORDER=\"0\">";
|
---|
| 333 | }
|
---|
| 334 |
|
---|
| 335 | function CloseTable(){
|
---|
| 336 | echo "</table>";
|
---|
| 337 | }
|
---|
| 338 |
|
---|
| 339 | function login() {
|
---|
[358] | 340 | global $param,$prefix,$dbi,$multicomune,$siteistat,$language,$tema, $id_cons_gen, $perms, $msglogout;
|
---|
[2] | 341 | if (isset($param['id_comune'])) $id_comune=intval($param['id_comune']);
|
---|
[31] | 342 | if (!isset($id_comune)) $id_comune=0;
|
---|
[358] | 343 | if(isset($_SESSION['aid'])){
|
---|
| 344 | session_regenerate_id();
|
---|
| 345 | }
|
---|
| 346 | $lang=(isset($_SESSION['lang']) and strlen($_SESSION['lang'])==2) ? $_SESSION['lang']: $language;
|
---|
[2] | 347 | $id_ses=session_id();
|
---|
[358] | 348 |
|
---|
[2] | 349 | //include("modules/Elezioni/language/lang-$lang.php");
|
---|
[358] | 350 | if($multicomune==''){
|
---|
| 351 | $sth = $dbi->prepare("select multicomune from ".$prefix."_config");
|
---|
| 352 | $sth->execute();
|
---|
| 353 | list($multicomune) = $sth->fetch(PDO::FETCH_NUM);
|
---|
| 354 | }
|
---|
[2] | 355 | include ("header.php");
|
---|
| 356 | echo "<div align=\"middle\"><font class=\"title\"><b>"._GESTIONE."</b></font></center>";
|
---|
[358] | 357 | echo "<br>"; # method=\"post\"
|
---|
| 358 | if ($msglogout==1) echo "<h1 style=\"color:red;\">Utente non autorizzato</h1><br>";
|
---|
| 359 | elseif ($msglogout==2) echo "<h1 style=\"color:red;\">Nome Utente non presente in archivio</h1><br>";
|
---|
| 360 | elseif ($msglogout==3) echo "<h1 style=\"color:red;\">Password Errata</h1><br>";
|
---|
| 361 | echo "<form name=\"login\" data-ajax=\"false\" method=\"post\" action=\"admin.php\">"
|
---|
[80] | 362 | ."<table class=\"table-menu\">"
|
---|
[2] | 363 | ."<tr><td>"._ADMINID."</td>"
|
---|
| 364 | ."<td><input type=\"text\" NAME=\"aid\" SIZE=\"20\" MAXLENGTH=\"25\"></td></tr>"
|
---|
| 365 | ."<tr><td>"._PASSWORD."</td>"
|
---|
| 366 | ."<td><input type=\"password\" NAME=\"pwd\" SIZE=\"20\" MAXLENGTH=\"18\"></td></tr>"
|
---|
| 367 | ."<tr><td>";
|
---|
| 368 | // scelta comune
|
---|
| 369 | if($multicomune=='1'){
|
---|
| 370 | echo ""._COMUNE."</td><td>";
|
---|
[332] | 371 | $sql="select * from ".$prefix."_ele_comuni order by descrizione asc";
|
---|
| 372 | $sth = $dbi->prepare("$sql");
|
---|
| 373 | $sth->execute();
|
---|
| 374 | $row = $sth->fetchAll();
|
---|
[2] | 375 | echo "<select name=\"id_comune\">";
|
---|
[255] | 376 | foreach($row as $comuni)
|
---|
| 377 | {$id=$comuni[0];$descrizione=$comuni[1];
|
---|
[2] | 378 | $sel=($id == $id_comune) ? "selected":"";
|
---|
| 379 | echo "<option value=\"$id\" $sel>$descrizione";
|
---|
| 380 | }
|
---|
| 381 | }else{
|
---|
| 382 | echo "<input type=\"hidden\" name=\"id_comune\" value=\"$siteistat\">";
|
---|
| 383 | }
|
---|
| 384 | // echo "<input type=\"hidden\" name=\"id_comune\" value=\"$id_comune\">";
|
---|
| 385 | if(strlen($lang)==2) echo "<input type=\"hidden\" name=\"language\" value=\"$lang\">";
|
---|
| 386 | echo "</td></tr><tr><td>";
|
---|
| 387 | echo "<input type=\"hidden\" name=\"id_ses\" value=\"$id_ses\">";
|
---|
| 388 | echo "<input type=\"submit\" VALUE=\""._OK."\">"
|
---|
| 389 | ."</td></tr></table>"
|
---|
| 390 | ."</form></div>";
|
---|
| 391 |
|
---|
| 392 | include ("footer.php");
|
---|
| 393 | }
|
---|
| 394 |
|
---|
| 395 | function logout()
|
---|
| 396 | {
|
---|
| 397 | /* $lang=$_SESSION['lang'];
|
---|
| 398 | $id_comune=$_SESSION['id_comune'];
|
---|
| 399 | // setcookie ("PHPSESSID", "", time() - 3600);
|
---|
| 400 | session_cache_expire (0);
|
---|
| 401 | $_SESSION=array(); //MODIFICHE PER GESTIONE SESSIONI
|
---|
| 402 | session_unset();
|
---|
| 403 | session_destroy();
|
---|
| 404 | Header("Location: admin.php?id_comune=$id_comune&language=$lang");
|
---|
| 405 | */
|
---|
[358] | 406 | global $siteistat,$perms,$msglogout;
|
---|
[2] | 407 |
|
---|
| 408 | $ref="Location: admin.php?";
|
---|
[358] | 409 | #$ref="Location: https://www.eleonline.it/adminmob/admin.php?";
|
---|
[2] | 410 | if (isset($_SESSION['id_comune']))
|
---|
| 411 | $id_comune=$_SESSION['id_comune'];
|
---|
| 412 | else
|
---|
| 413 | $id_comune=$siteistat;
|
---|
| 414 | $ref=$ref."id_comune=".$id_comune;
|
---|
| 415 |
|
---|
| 416 | if (isset($_SESSION['lang']))
|
---|
| 417 | $ref=$ref."&language=".$_SESSION['lang'];
|
---|
[358] | 418 | $ref.="&msglogout=$msglogout";
|
---|
[2] | 419 | $_SESSION=array();
|
---|
| 420 | session_unset();
|
---|
| 421 | session_destroy();
|
---|
[291] | 422 | session_cache_expire (0);
|
---|
[2] | 423 | Header($ref);
|
---|
| 424 |
|
---|
| 425 | }
|
---|
[358] | 426 | #include("TEST tema: $tema--");
|
---|
| 427 | #include("modules/Elezioni/language/lang-".$_SESSION['lang'].".php");
|
---|
| 428 | if(isset($id_cons_gen) and isset($id_comune)){
|
---|
| 429 | if(!isset($id_cons)){
|
---|
| 430 | # $sql = "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'";
|
---|
| 431 | $sql = "SELECT id_cons from ".$prefix."_ele_comuni where id_comune='$id_comune'";
|
---|
| 432 | $sth = $dbi->prepare("$sql");
|
---|
| 433 | $sth->execute();
|
---|
| 434 | if ($sth->rowCount()) list($id_cons) = $sth->fetch(PDO::FETCH_NUM);
|
---|
| 435 | $_SESSION['id_cons']=$id_cons;
|
---|
| 436 | }
|
---|
| 437 | if(isset($id_cons)) {
|
---|
| 438 | $sql="SELECT id_sez FROM ".$prefix."_ele_operatori where id_cons=$id_cons and aid='$aid' and id_comune=$id_comune";
|
---|
| 439 | $resmod = $dbi->prepare("$sql");
|
---|
| 440 | $resmod->execute();
|
---|
| 441 | list($id_sez) = $resmod->fetch(PDO::FETCH_NUM);
|
---|
| 442 | if($id_sez) $tema='Futura2';#die( "TEST id_cons:$id_cons:");
|
---|
| 443 | $_SESSION['tema']=$tema;
|
---|
| 444 | }
|
---|
| 445 | }
|
---|
[255] | 446 | #echo "op:".$param['op']." -- aid:".$_SESSION['aid']."remote:".$_SESSION['remote']."REMOTE:".$_SERVER['REMOTE_ADDR'];
|
---|
[344] | 447 | if (isset($param['op'])) $op=addslashes($param['op']); else $op='ele';
|
---|
[2] | 448 | //if (isset($param['op'])) $op=$param['op']; else $op='ele';
|
---|
[358] | 449 | #die( "OP: $op");
|
---|
[2] | 450 | if (isset($_SESSION['aid']) AND $_SESSION['remote']==$_SERVER['REMOTE_ADDR']) {
|
---|
[358] | 451 | if($tema=='Futura2' and $op!='logout')
|
---|
| 452 | {
|
---|
| 453 | include("temi/$tema/index.php");
|
---|
| 454 | testata();
|
---|
| 455 | }else
|
---|
[2] | 456 | switch($op) {
|
---|
| 457 | case "tipo":
|
---|
| 458 | include("modules/Elezioni/ele_tipi.php");
|
---|
| 459 | break;
|
---|
| 460 | case "constipi":
|
---|
| 461 | include("modules/Elezioni/ele_consultazionitipi.php");
|
---|
| 462 | break;
|
---|
| 463 | case "aggiorna":
|
---|
| 464 | include("modules/Elezioni/aggiorna.php");
|
---|
| 465 | break;
|
---|
| 466 | case "parziali":
|
---|
| 467 | include("modules/Elezioni/ele_parziali.php");
|
---|
| 468 | break;
|
---|
| 469 | case "ele":
|
---|
| 470 | include("modules/Elezioni/ele.php");
|
---|
| 471 | break;
|
---|
| 472 | case "consultazione":
|
---|
| 473 | include("modules/Elezioni/ele_consultazioni.php");
|
---|
| 474 | break;
|
---|
| 475 | case "configurazione":
|
---|
| 476 | include("modules/Elezioni/ele_configurazione.php");
|
---|
| 477 | break;
|
---|
| 478 | case "cons_comuni":
|
---|
| 479 | include("modules/Elezioni/ele_cons_comuni.php");
|
---|
| 480 | break;
|
---|
| 481 | case "confconsiglio":
|
---|
| 482 | include("modules/Elezioni/ele_confcons.php");
|
---|
| 483 | break;
|
---|
| 484 | case "inscomuni":
|
---|
| 485 | include("modules/Elezioni/ele_comuni.php");
|
---|
| 486 | break;
|
---|
| 487 | case "oper_admin":
|
---|
| 488 | include("modules/Elezioni/ele_operatori.php");
|
---|
| 489 | break;
|
---|
| 490 | case "inscollegi":
|
---|
| 491 | include("modules/Elezioni/ele_collegi.php");
|
---|
| 492 | break;
|
---|
| 493 | case "associazioni":
|
---|
| 494 | include("modules/Elezioni/ele_associazioni.php");
|
---|
| 495 | break;
|
---|
| 496 | case "operatori":
|
---|
| 497 | include("modules/Elezioni/ele_operatori.php");
|
---|
| 498 | break;
|
---|
| 499 | case "permessi":
|
---|
| 500 | include("modules/Elezioni/ele_permessi.php");
|
---|
| 501 | break;
|
---|
| 502 | case "circo":
|
---|
| 503 | include("modules/Elezioni/ele_circo.php");
|
---|
| 504 | break;
|
---|
| 505 | case "sede":
|
---|
| 506 | include("modules/Elezioni/ele_sede.php");
|
---|
| 507 | break;
|
---|
| 508 | case "sezione":
|
---|
| 509 | include("modules/Elezioni/ele_sezione.php");
|
---|
| 510 | break;
|
---|
| 511 | case "gruppo":
|
---|
| 512 | include("modules/Elezioni/ele_gruppo.php");
|
---|
| 513 | break;
|
---|
| 514 | case "rec_add_aff":
|
---|
| 515 | include("modules/Elezioni/ele_affluenze.php");
|
---|
| 516 | break;
|
---|
| 517 | case "rec_add_mod":
|
---|
| 518 | include("modules/Elezioni/ele_modelli.php");
|
---|
| 519 | break;
|
---|
| 520 | case "upgruppo":
|
---|
| 521 | include("modules/Elezioni/ele_gruppo.php");
|
---|
| 522 | break;
|
---|
| 523 | case "delimggruppo":
|
---|
| 524 | include("modules/Elezioni/ele_gruppo.php");
|
---|
| 525 | break;
|
---|
| 526 | case "lista":
|
---|
| 527 | include("modules/Elezioni/ele_lista.php");
|
---|
| 528 | break;
|
---|
| 529 | case "uplista":
|
---|
| 530 | include("modules/Elezioni/ele_lista.php");
|
---|
| 531 | break;
|
---|
| 532 | case "delimglista":
|
---|
| 533 | include("modules/Elezioni/ele_lista.php");
|
---|
| 534 | break;
|
---|
| 535 | case "candidato":
|
---|
| 536 | include("modules/Elezioni/ele_candidato.php");
|
---|
| 537 | break;
|
---|
| 538 | case "upcandidato":
|
---|
| 539 | include("modules/Elezioni/ele_candidato.php");
|
---|
| 540 | break;
|
---|
| 541 | case "delimgcandidato":
|
---|
| 542 | include("modules/Elezioni/ele_candidato.php");
|
---|
| 543 | break;
|
---|
| 544 |
|
---|
| 545 | case "voti":
|
---|
| 546 | include("modules/Elezioni/ele_voti.php");
|
---|
| 547 | break;
|
---|
| 548 | case "sezioni_voti":
|
---|
| 549 | include("modules/Elezioni/ele_voti.php");
|
---|
| 550 | break;
|
---|
| 551 | case "rec_voti":
|
---|
| 552 | include("modules/Elezioni/ele_voti.php");
|
---|
| 553 | break;
|
---|
| 554 | case "rec_voti_gruppi":
|
---|
| 555 | include("modules/Elezioni/ele_voti.php");
|
---|
| 556 | break;
|
---|
| 557 | case "rec_add_votanti":
|
---|
| 558 | include("modules/Elezioni/ele_voti.php");
|
---|
| 559 | break;
|
---|
| 560 | case "rec_finale":
|
---|
| 561 | include("modules/Elezioni/ele_voti.php");
|
---|
| 562 | break;
|
---|
| 563 | case "controllo_voti":
|
---|
| 564 | include("modules/Elezioni/controllo_voti.php");
|
---|
| 565 | break;
|
---|
| 566 | case "controllo_votanti":
|
---|
| 567 | include("modules/Elezioni/controllo_votanti.php");
|
---|
| 568 | break;
|
---|
| 569 | case "come":
|
---|
| 570 | include("modules/Elezioni/ele_come.php");
|
---|
| 571 | break;
|
---|
| 572 | case "numeri":
|
---|
| 573 | include("modules/Elezioni/ele_come.php");
|
---|
| 574 | break;
|
---|
| 575 | case "servizi":
|
---|
| 576 | include("modules/Elezioni/ele_come.php");
|
---|
| 577 | break;
|
---|
| 578 | case "link":
|
---|
| 579 | include("modules/Elezioni/ele_come.php");
|
---|
| 580 | break;
|
---|
| 581 | case "conf":
|
---|
| 582 | include("modules/Elezioni/ele_conf.php");
|
---|
| 583 | break;
|
---|
| 584 | case "stampa":
|
---|
| 585 | include("modules/Elezioni/ele_stampe.php");
|
---|
| 586 | break;
|
---|
| 587 | case "cambiopwd":
|
---|
| 588 | include("modules/Elezioni/ele_pwd.php");
|
---|
| 589 | break;
|
---|
| 590 | case "eletti":
|
---|
| 591 | include("modules/Elezioni/ele_eletti.php");
|
---|
| 592 | break;
|
---|
| 593 | case "foto":
|
---|
| 594 | include("modules/Elezioni/foto.php");
|
---|
| 595 | break;
|
---|
| 596 | case "consiglieri":
|
---|
| 597 | include("modules/Elezioni/ele_consiglieri.php");
|
---|
| 598 | break;
|
---|
| 599 | case "backup":
|
---|
| 600 | include("modules/Elezioni/backup.php");
|
---|
| 601 | break;
|
---|
| 602 | case "restore":
|
---|
| 603 | include("modules/Elezioni/restore.php");
|
---|
| 604 | break;
|
---|
| 605 | case "scarica":
|
---|
| 606 | include("modules/Elezioni/scarica.php");
|
---|
| 607 | break;
|
---|
| 608 | case "importa":
|
---|
| 609 | include("modules/Elezioni/importa.php");
|
---|
| 610 | break;
|
---|
[80] | 611 | case "widget":
|
---|
| 612 | include("modules/Elezioni/ele_widget.php");
|
---|
[2] | 613 | break;
|
---|
[139] | 614 | case "riepilogo":
|
---|
| 615 | include("modules/Elezioni/ele_riepilogo.php");
|
---|
| 616 | break;
|
---|
[254] | 617 | case "riepilogovoti":
|
---|
| 618 | include("modules/Elezioni/ele_riepilogovoti.php");
|
---|
| 619 | break;
|
---|
[2] | 620 | case "logout":
|
---|
| 621 | logout();
|
---|
| 622 | break;
|
---|
| 623 | }
|
---|
[258] | 624 |
|
---|
[2] | 625 | }else {
|
---|
| 626 |
|
---|
| 627 | login();
|
---|
| 628 |
|
---|
| 629 | }
|
---|
| 630 |
|
---|
| 631 | ?>
|
---|