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