"lax"]); //none, lax, strict session_set_cookie_params(["Secure" => "true"]); //false, true session_set_cookie_params(["HttpOnly" => "true"]); //false, true //session_start(); ?> "; if (strlen($estremicata) > 8){ $_SESSION['cataparticella'] = substr($estremicata,0,-1); } else { $_SESSION['cataparticella'] = $estremicata; } } if (empty($_GET['readOnly'])) { $_SESSION['STATUS'] = ''; } else { $_SESSION['STATUS'] = $_GET['readOnly']; } if (empty($_GET['idPratica'])) { $_SESSION['IDPRATICA'] = 0; } else { $_SESSION['IDPRATICA'] = $_GET['idPratica']; } if (empty($_GET['npratica'])) { $npratica = "0"; } else { $npratica = $_GET['npratica']; } if (empty($_GET['lat'])) { $_SESSION['LAT'] = 0; } else { $_SESSION['LAT'] = $_GET['lat']; } if (empty($_GET['lng'])) { $_SESSION['LONG'] = 0; } else { $_SESSION['LONG'] = $_GET['lng']; } $rs_provincia = "SELECT provincia FROM public.comuni WHERE cod_belf = '" . $_SESSION['COMUNE_BELF'] . "'"; $result_prov = pg_query($conn, $rs_provincia) or die('Query failed0'); if (pg_num_rows($result_prov) > 0) { while ($result_row = pg_fetch_assoc($result_prov)) { //$_SESSION['COMUNE_PROV'] = strtolower($result_row['provincia']); $_SESSION['COMUNE_PROV'] = $result_row['provincia']; switch ($result_row['provincia']) { case "SR": $_SESSION['PROV_NOME'] = "Siracusa"; break; case "CT": $_SESSION['PROV_NOME'] = "Catania"; break; case "EN": $_SESSION['PROV_NOME'] = "Enna"; break; case "PA": $_SESSION['PROV_NOME'] = "Palermo"; break; case "RG": $_SESSION['PROV_NOME'] = "Ragusa"; break; case "ME": $_SESSION['PROV_NOME'] = "Messina"; break; case "CL": $_SESSION['PROV_NOME'] = "Caltanissetta"; break; case "TP": $_SESSION['PROV_NOME'] = "Trapani"; break; case "AG": $_SESSION['PROV_NOME'] = "Agrigento"; break; default: $_SESSION['PROV_NOME'] = ""; } } } if ($_GET['client'] == 'BO') { $routine_map = 'routine_map_bckoffice'; } elseif ($_GET['client'] == 'RG') { //RICERCA GEOGRAFICA if (empty($_GET['prov'])) { $_SESSION['COMUNE_PROV'] = ""; $rs_provincia = "SELECT provincia FROM public.comuni WHERE cod_belf = '" . $_SESSION['COMUNE_BELF'] . "'"; $result_prov = pg_query($conn, $rs_provincia) or die('Query failed0'); if (pg_num_rows($result_prov) > 0) { while ($result_row = pg_fetch_assoc($result_prov)) { //$_SESSION['COMUNE_PROV'] = strtolower($result_row['provincia']); $_SESSION['COMUNE_PROV'] = $result_row['provincia']; switch ($result_row['provincia']) { case "SR": $_SESSION['PROV_NOME'] = "Siracusa"; break; case "CT": $_SESSION['PROV_NOME'] = "Catania"; break; case "EN": $_SESSION['PROV_NOME'] = "Enna"; break; case "PA": $_SESSION['PROV_NOME'] = "Palermo"; break; case "RG": $_SESSION['PROV_NOME'] = "Ragusa"; break; case "ME": $_SESSION['PROV_NOME'] = "Messina"; break; case "CL": $_SESSION['PROV_NOME'] = "Caltanissetta"; break; case "TP": $_SESSION['PROV_NOME'] = "Trapani"; break; case "AG": $_SESSION['PROV_NOME'] = "Agrigento"; break; default: $_SESSION['PROV_NOME'] = ""; } } } } else { $_SESSION['COMUNE_PROV'] = $_GET['prov']; $_SESSION['DATA_PROV'] = "prov"; switch ($_GET['prov']) { case "SR": $_SESSION['PROV_NOME'] = "Siracusa"; break; case "CT": $_SESSION['PROV_NOME'] = "Catania"; break; case "EN": $_SESSION['PROV_NOME'] = "Enna"; break; case "PA": $_SESSION['PROV_NOME'] = "Palermo"; break; case "RG": $_SESSION['PROV_NOME'] = "Ragusa"; break; case "ME": $_SESSION['PROV_NOME'] = "Messina"; break; case "CL": $_SESSION['PROV_NOME'] = "Caltanissetta"; break; case "TP": $_SESSION['PROV_NOME'] = "Trapani"; break; case "AG": $_SESSION['PROV_NOME'] = "Agrigento"; break; default: $_SESSION['PROV_NOME'] = ""; } } if (empty($_GET['idcom'])) { $_SESSION['COMUNE_BELF'] = ""; } else { $_SESSION['COMUNE_BELF'] = $_GET['idcom']; $_SESSION['DATA_PROV'] = "comu"; } $routine_map = 'routine_map_ricercageo'; $url = $_GET['url']; function getCurl(string $url): ?array { $result = null; $curl = curl_init($url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_PROXY, '172.21.1.1:3128'); $data = curl_exec($curl); $rc = curl_getinfo($curl, CURLINFO_HTTP_CODE); curl_close($curl); if (200 == $rc) { $result = json_decode($data, true); } return $result; } $list = getCurl($url); // Inizio Modifica TURE $geodata = [ 'type' => 'FeatureCollection', 'crs' => [ 'type' => 'name', 'properties' => [ 'name' => 'urn:ogc:def:crs:EPSG::4326', ], ], 'features' => [], ]; foreach ($list as $item) { $geodata['features'][] = [ 'type' => 'Feature', 'properties' => [ 'prov' => $item['provincia'], 'comune' => $item['nomeComune'], 'descrizione' => $item['descrizione'], 'estremi_catastali' => $item['estremiCatastali'], 'lat' => $item['lat'], 'lng' => $item['lng'], 'numero_progetto' => $item['numeroProgetto'], 'url' => $item['url'], ], 'geometry' => [ 'type' => 'Point', 'coordinates' => [ $item['lng'], $item['lat'], ], ], ]; } $_SESSION['GEODATA'] = json_encode($geodata, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); // Fine modifica Ture } else { $routine_map = 'routine_map'; //INSERISCE LOG $instanza = "INSERT INTO public.istanze (comune,data_creaz,estremi_catastali,attivo,auth,idpratica,npratica,lat,lng) VALUES ('" . $_GET['idcom'] . "', '" . date("Y-m-d h:i:sa", time()) . "', '" . $_SESSION['cataparticella'] . "', '" . $_GET['readOnly'] . "', '" . $_GET['auth'] . "', " . $_SESSION['IDPRATICA'] . ", '" . $npratica . "', " . $_SESSION['LAT'] . ", ".$_SESSION['LONG'].")"; //echo $instanza; $result_instanza = pg_query($conn, $instanza) or die('Query failed3'); function getSharedSecret(): string { return 'prosecco'; } function verificaLogin($httpReferer, $date, $auth) { $remoteHost = parse_url($httpReferer, PHP_URL_HOST); $hash = hash('sha256', $date . getSharedSecret() . $remoteHost); return $hash === $auth; } if (!verificaLogin($_SERVER['HTTP_REFERER'], $_GET['date'], $_GET['auth'])) { // Il server remoto non si รจ autenticato correttamente. echo 'REFERER:' . $_SERVER['HTTP_REFERER'] . "
"; echo '

Accesso non autorizzato

'; } $rs_comune = "SELECT * FROM public.comuni WHERE cod_belf = '" . $_SESSION['COMUNE_BELF'] . "'"; $result = pg_query($conn, $rs_comune) or die('Query failed4'); $row_comune = pg_num_rows($result); if ($row_comune > 0) { while ($comunesession = pg_fetch_assoc($result)) { $_SESSION['COMUNE_NAME'] = $comunesession['comune']; $_SESSION['COMUNE_ISTAT'] = "0" . substr($comunesession['cod_istat'], 0, 2); $_SESSION['COMUNE_PROV'] = $comunesession['provincia']; $_SESSION['CENTER'] = $comunesession['lat'] .", ".$comunesession['long']; $_SESSION['BOUND'] = $comunesession['bound']; } } $arraymappale = explode(';', $_SESSION['cataparticella']); if (count($arraymappale) > 0) { foreach ($arraymappale as $index => $mappale) { if (!$query = @pg_query("SELECT id FROM ".strtolower($_SESSION['COMUNE_PROV']).".particelle WHERE comune = '" . $_SESSION['COMUNE_BELF'] . "' AND mappale ='" . $mappale . "';")) die("Errore nella query CERCA PARTICELLA: " . pg_last_error($conn)); if (pg_numrows($query) > 0) { while ($rowparticelle = pg_fetch_assoc($query)) { $gidquery[] = $rowparticelle['id']; } } } //$valorearray = count($gidquery); $stringa = implode(' OR id=', $gidquery); $_SESSION['QUERY_CDU'] = $stringa; $_SESSION['GET_CDU'] = 1; } else { unset($_SESSION['cataparticella']); unset($_SESSION['QUERY_CDU']); $_SESSION['GET_CDU'] = 0; } } ?>