Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
413 righe
13 KiB
413 righe
13 KiB
<?php |
|
if (session_id() == "") session_start(); |
|
ob_start(); |
|
session_unset(); |
|
session_destroy(); |
|
unset($_SESSION['COMUNE_BELF']); |
|
unset($_SESSION['COMUNE_PROV']); |
|
unset($_SESSION['ZOOM']); |
|
unset($_SESSION['CENTER']); |
|
unset($_SESSION['BOUND']); |
|
|
|
?> |
|
<?php include_once "cfg_srv.php" ?> |
|
<!DOCTYPE html> |
|
<html lang="en"> |
|
|
|
<head> |
|
<meta charset="utf-8"> |
|
<!--meta http-equiv="X-Frame-Options" content="SAMEORIGIN"--> |
|
<meta http-equiv="cache-control" content="no-cache" /> |
|
<meta name="referrer" content="no-referrer" /> |
|
<title>Paesaggistica Sicilia</title> |
|
|
|
<!-- HEADER --> |
|
<link rel="stylesheet" href="assets/css/loader.css" /> |
|
<style> |
|
.p2 { |
|
padding: 4px !important; |
|
} |
|
|
|
.scheda { |
|
background: #fff; |
|
-webkit-box-shadow: 4px 4px 8px 0 rgba(0, 0, 0, 0.1); |
|
-moz-box-shadow: 4px 4px 8px 0 rgba(0, 0, 0, 0.1); |
|
box-shadow: 4px 4px 8px 0 rgba(0, 0, 0, 0.1); |
|
border: 1px solid #eceff1; |
|
position: relative; |
|
/*height: 100%;*/ |
|
display: flex; |
|
flex-direction: column; |
|
} |
|
|
|
.scheda-round { |
|
border-radius: 4px; |
|
padding: 10px; |
|
height: 230px; |
|
} |
|
</style> |
|
</head> |
|
|
|
<?php |
|
session_set_cookie_params(["SameSite" => "lax"]); //none, lax, strict |
|
session_set_cookie_params(["Secure" => "true"]); //false, true |
|
session_set_cookie_params(["HttpOnly" => "true"]); //false, true |
|
//session_start(); |
|
?> |
|
|
|
<?php include_once "cfg.php" ?> |
|
|
|
<?php |
|
|
|
// https://paesaggistica.sicilia.it/rs/index?client=RG&prov=&idcom=G211&url=https%3A%2F%2Fpaesaggistica.sicilia.it%2Fportos-bo-portlet%2Fmappe%2Flist%3Fc%3D23576&date=1652128505&auth=57a4a0fc2935e5f88f1b91c7c6a79faa12272fff7ee9396a68243aa7890d942d |
|
|
|
// https://paesaggistica.sicilia.it/rs/index?client=RG&prov=SR&idcom=&url=https%3A%2F%2Fpaesaggistica.sicilia.it%2Fportos-bo-portlet%2Fmappe%2Flist%3Fp%3D089&date=1652128894&auth=5729f4d46501d3ea8ce5b5256df69c1549288fe79c869bb3bb07e9710ff1bf4a |
|
|
|
if (empty($_GET['idcom'])) { |
|
$idcomume = '0'; |
|
} else { |
|
$_SESSION['COMUNE_BELF'] = strtoupper($_GET['idcom']); |
|
} |
|
|
|
if (empty($_GET['estremiCatastali'])) { |
|
$_SESSION['cataparticella'] = ""; |
|
} else { |
|
$estremicata = trim($_GET['estremiCatastali']); |
|
//echo "estremicata = ".$estremicata."<br>"; |
|
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'] . "<br>"; |
|
echo '<h1>Accesso non autorizzato</h1>'; |
|
} |
|
|
|
|
|
$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; |
|
} |
|
} |
|
?> |
|
<!-- BODY --> |
|
|
|
<body> |
|
<main class="col-12 col-md-12 col-xl-12 py-md-3 px-md-3 bd-content"> |
|
<div class="container2"> |
|
<div style="width: 100%!important"> |
|
<div class="row"> |
|
<div class="col-md-12"> |
|
<div class="row row-eq-height"> |
|
|
|
<div class='container'> |
|
<i class='layer'></i> |
|
<i class='layer'></i> |
|
<i class='layer'></i> |
|
</div> |
|
<iframe src="<?php echo $routine_map; ?>.php" style="width:0;height:0;border: 0px;border: none;background-color: #ADDBFF" referrerpolicy="strict-origin-when-cross-origin"></iframe> |
|
</div> |
|
|
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
|
|
<?php |
|
if ($_GET['client'] == 'RG') { |
|
header("refresh:1;url=bckmap"); |
|
} elseif ($_GET['client'] == 'BO') { |
|
header("refresh:1;url=detail"); |
|
} else { |
|
header("refresh:1;url=intro"); |
|
} |
|
|
|
?> |
|
</main> |
|
</body> |
|
|
|
</html>
|