Changeset 406


Ignore:
Timestamp:
Feb 28, 2024, 3:32:10 PM (2 months ago)
Author:
roby
Message:

Modifiche alla gestione degli operatori

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/admin.php

    r400 r406  
    340340if (isset($_GET['id_cons_gen'])) {$id_cons_gen=intval($_GET['id_cons_gen']);}
    341341else {
    342         $oggi=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-3,date("Y")));
    343         $sql="select t1.id_cons_gen from ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2 where t1.id_cons_gen=t2.id_cons_gen and t2.id_comune=$id_comune and t1.data_fine>'$oggi' and t2.id_cons in (select id_cons from ".$prefix."_ele_operatori where aid='$aid' and permessi>0) limit 0,1"; # TEST: and id_sez>0
     342#       $oggi=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-3,date("Y")));
     343        $sql="select t1.id_cons_gen from ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2 where t1.id_cons_gen=t2.id_cons_gen and t2.id_comune=$id_comune and date_add(t1.data_fine, interval 3 day)>CURDATE() and t2.id_cons in (select id_cons from ".$prefix."_ele_operatori where aid='$aid' and permessi>0) limit 0,1"; # TEST: and id_sez>0
    344344        $rese = $dbi->prepare("$sql");
    345345        $rese->execute();
     
    370370/* Login Function                                        */
    371371/*********************************************************/
    372 function ChiSei($id_cons_gen){
    373 global $dbi, $msglogout;
     372function ChiSei($idcg){
     373global $dbi, $msglogout, $id_cons_gen;
    374374
    375375$aid=$_SESSION['aid'];
     
    377377$pwd=$_SESSION['pwd'];
    378378$id_comune=$_SESSION['id_comune'];
    379 
     379#echo "prima: $idcg - dopo: $id_cons_gen<br>";
    380380$perms=0;
    381381$sql="select adminsuper, admincomune, adminop  from ".$prefix."_authors where aid='$aid' and pwd='$pwd' and (id_comune='$id_comune' or id_comune=0)";
     
    394394        elseif($oper) {$msglogout=1; return 0;} # id_cons='$id_cons' and
    395395        else {
    396                 $oggi=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-3,date("Y")));
    397                 $sql="select t1.id_cons from ".$prefix."_ele_cons_comune as t1, ".$prefix."_ele_consultazione as t2 where t1.id_cons_gen=t2.id_cons_gen and t1.id_cons_gen='$id_cons_gen' and t1.chiusa='0' and t1.id_comune='$id_comune' and t2.data_fine>$oggi";
     396#               $oggi=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-3,date("Y")));
     397                $sql="select t1.id_cons, t1.id_cons_gen from ".$prefix."_ele_cons_comune as t1, ".$prefix."_ele_consultazione as t2 where t1.id_cons_gen=t2.id_cons_gen and t1.chiusa='0' and t1.id_comune='$id_comune' and date_add(t2.data_fine, interval 3 day)>CURDATE()";
    398398                $sth = $dbi->prepare("$sql");
    399                 $sth->execute();        #die("TEST: $sql");     
    400                 if(!$sth->rowCount()) {$msglogout=1; $perms=0; return $perms;}
    401                 list($id_cons) = $sth->fetch(PDO::FETCH_NUM);
     399                $sth->execute();       
     400                if(!$sth->rowCount()) { $msglogout=1; $perms=0; return $perms;}
     401                list($id_cons,$idcg) = $sth->fetch(PDO::FETCH_NUM);           
     402                if (!$id_cons_gen) $id_cons_gen=$idcg;
    402403                $sql="select permessi from ".$prefix."_ele_operatori where id_cons='$id_cons' and aid='$aid'";
    403404                $sth = $dbi->prepare("$sql");
    404                 $sth->execute();        #die("TEST: $sql");     
     405                $sth->execute();               
    405406                list($perms) = $sth->fetch(PDO::FETCH_NUM);
     407                return $perms;
    406408        }
    407409}
     
    416418
    417419function login() {
    418     global $param,$prefix,$dbi,$multicomune,$siteistat,$language,$tema, $id_cons_gen, $perms, $msglogout;
     420    global $param,$prefix,$dbi,$multicomune,$siteistat,$language,$tema, $perms, $msglogout;#, $id_cons_gen
    419421    if (isset($param['id_comune'])) $id_comune=intval($param['id_comune']);
    420422    if (!isset($id_comune)) $id_comune=0;
     
    433435    include ("header.php");
    434436    echo "<div align=\"middle\"><font class=\"title\"><b>"._GESTIONE."</b></font></center>";
    435     echo "<br>";  # method=\"post\"
    436437        if ($msglogout==1) echo "<h1 style=\"color:red;\">Utente non autorizzato</h1><br>";
    437438        elseif ($msglogout==2) echo "<h1 style=\"color:red;\">Nome Utente non presente in archivio</h1><br>";
     
    506507#include("TEST tema: $tema--");
    507508#include("modules/Elezioni/language/lang-".$_SESSION['lang'].".php");
    508 
     509#die( "$sql <br> TEST id_cons_gen:$id_cons_gen:".$_SESSION['id_cons_gen']);
    509510if(isset($id_cons_gen) and isset($id_comune)){
    510         if(!isset($id_cons)){
     511        if(!isset($id_cons)){ 
    511512#               $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'";
    512513                $sql = "SELECT id_cons from ".$prefix."_ele_comuni where id_comune='$id_comune'";
     
    531532                        die();
    532533                }
    533                 list($id_sez) = $resmod->fetch(PDO::FETCH_NUM); #die("qui:$id_sez:$sql");
    534                 if($id_sez) {
    535                         $oggi=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-3,date("Y")));
    536                         $sql="select t1.id_cons_gen,t1.descrizione,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_comune=$id_comune and t1.data_fine>'$oggi' and t2.id_cons in (select id_cons from ".$prefix."_ele_operatori where aid='$aid' and id_sez>0 and permessi>0)";
     534                list($id_sez) = $resmod->fetch(PDO::FETCH_NUM);
     535                if($id_sez) {
     536                        $sql="select t1.id_cons_gen,t1.descrizione,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_comune=$id_comune and date_add(t1.data_fine, interval 3 day)>CURDATE() and t2.id_cons in (select id_cons from ".$prefix."_ele_operatori where aid='$aid' and id_sez>0 and permessi>0)";
    537537                        $resmod = $dbi->prepare("$sql");
    538538                        $resmod->execute();
    539539                        if ($resmod->rowCount()>0) {
    540                                 $tema='Futura2'; #die( "TEST id_cons:$id_cons:".$_SESSION['aid']);
     540                                list($id_cons_gen, $desc,$id_cons)=$resmod->fetch(PDO::FETCH_NUM);
     541                                $tema='Futura2';
    541542                                $_SESSION['tema']=$tema;
    542543                        } #else {die("TEST: $sql"); logout();}
    543544                }
    544         }
    545 $perms=ChiSei($id_cons_gen); #die("qui".$_SESSION['aid']);
     545        } 
     546$perms=ChiSei($id_cons_gen);
    546547if($perms==0) {logout();}
    547548}
     
    551552//if (isset($param['op'])) $op=$param['op']; else $op='ele';
    552553#
    553 #die("TEST: qui $aid $id_cons $id_sez ".$_SESSION['aid']);
     554#die("TEST: qui2 op:$op - $aid $id_cons $id_sez ".$_SESSION['aid']);
    554555
    555556if (isset($_SESSION['aid']) AND $_SESSION['remote']==$_SERVER['REMOTE_ADDR']) {
  • trunk/admin/modules/Elezioni/query.sql

    r400 r406  
    1 <?php
     1 <?php
    22
    33if (!defined('ADMIN_FILE')) {
     
    6666        else
    6767                $sql = "SELECT t1.tipo_cons,t1.descrizione,t2.id_cons_gen FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2, ".
    68                 $prefix."_ele_operatori as t3 where t3.id_comune=$id_comune and t3.id_comune=t2.id_comune and t1.id_cons_gen=t2.id_cons_gen and t2.chiusa='0' and (t3.id_cons=t2.id_cons or t3.id_cons=0) and t3.permessi>0 and t3.aid='$aid' order by t1.data_fine desc limit 0,1 ";
     68                $prefix."_ele_operatori as t3 where t3.id_comune=$id_comune and t3.id_comune=t2.id_comune and t1.id_cons_gen=t2.id_cons_gen and t2.chiusa='0' and (t3.id_cons=t2.id_cons or t3.id_cons=0) and t3.permessi>0 and date_add(t1.data_fine, interval 3 day)>CURDATE() and t3.aid='$aid' order by t1.data_fine desc limit 0,1 ";
     69
    6970}
    7071        $sth = $dbi->prepare("$sql");
     
    9697{
    9798global $perms,$dbi,$prefix,$currentlang,$aid,$id_comune;
    98         if ($perms<128) {
    99                 $sql="select t3.id_cons, t2.descrizione,t4.genere, t2.id_cons_gen, t3.chiusa from ".$prefix."_ele_operatori as t1, ".$prefix."_ele_consultazione as t2, ".$prefix."_ele_cons_comune as t3, ".$prefix."_ele_tipo as t4 where t4.lingua='$currentlang' and t2.tipo_cons=t4.tipo_cons and t1.aid='$aid' and t1.permessi>0 and t3.id_cons_gen=t2.id_cons_gen and (t1.id_cons=t3.id_cons or t1.permessi=64) and t1.id_comune=t3.id_comune and t1.id_comune=$id_comune and t3.chiusa='0' order by t2.data_inizio desc";
     99
     100        if ($perms<64) {
     101                $sql="select t2.id_cons,t1.descrizione,t4.genere,t1.id_cons_gen,t2.chiusa from ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2, ".$prefix."_ele_tipo as t4 where t1.id_cons_gen=t2.id_cons_gen and t2.id_comune=$id_comune and t1.tipo_cons=t4.tipo_cons and date_add(t1.data_fine, interval 3 day)>CURDATE() and t2.id_cons in (select id_cons from ".$prefix."_ele_operatori where aid='$aid' and permessi>0)";
     102        }
     103        elseif ($perms<128) {
     104                $sql="select t3.id_cons, t2.descrizione,t4.genere, t2.id_cons_gen, t3.chiusa from ".$prefix."_ele_operatori as t1, ".$prefix."_ele_consultazione as t2, ".$prefix."_ele_cons_comune as t3, ".$prefix."_ele_tipo as t4 where t4.lingua='$currentlang' and t2.tipo_cons=t4.tipo_cons and t1.aid='$aid' and t1.permessi>0 and t3.id_cons_gen=t2.id_cons_gen and (t1.id_cons=t3.id_cons or t1.permessi=64) and t1.id_comune=t3.id_comune and t1.id_comune=$id_comune order by t2.data_inizio desc";
    100105        }else{
    101106                $sql="SELECT '', t1.descrizione,t2.genere, t1.id_cons_gen,'' FROM ".$prefix."_ele_consultazione as t1,".$prefix."_ele_tipo as t2 where t2.lingua='$currentlang' and t1.tipo_cons=t2.tipo_cons order by t1.data_inizio desc";
    102         }
     107        } #die("$sql");
    103108        $sth = $dbi->prepare("$sql");
    104109        $sth->execute();       
  • trunk/admin/versione.php

    r405 r406  
    11<?php
    22
    3 $versione = "3.0 rev 405";
     3$versione = "3.0 rev 406";
    44$version_number = $versione;
    55$datarel = "28 febbraio 2024";
  • trunk/client/versione.php

    r405 r406  
    11<?php
    22
    3 $versione = "3.0 rev 405";
     3$versione = "3.0 rev 406";
    44$version_number = $versione;
    55$datarel = "28 febbraio 2024";
Note: See TracChangeset for help on using the changeset viewer.