????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.217.84 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/www.supervision-online.se/login/scripts/ |
Upload File : |
<?php
// Conversion from grid coordinates to geodetic coordinates.
function grid_to_geodetic($x, $y, $central_meridian) {
$lat_lon[] = 2;
$axis = 6378137.0; // GRS 80.
$flattening = 1.0 / 298.257222101; // GRS 80.
$lat_of_origin = 0.0;
$scale = 1.0;
$false_northing = 0.0;
$false_easting = 150000.0;
// Prepare ellipsoid-based stuff.
$e2 = $flattening * (2.0 - $flattening);
$n = $flattening / (2.0 - $flattening);
$a_roof = $axis / (1.0 + $n) * (1.0 + $n*$n/4.0 + $n*$n*$n*$n/64.0);
$delta1 = $n/2.0 - 2.0*$n*$n/3.0 + 37.0*$n*$n*$n/96.0 - $n*$n*$n*$n/360.0;
$delta2 = $n*$n/48.0 + $n*$n*$n/15.0 - 437.0*$n*$n*$n*$n/1440.0;
$delta3 = 17.0*$n*$n*$n/480.0 - 37*$n*$n*$n*$n/840.0;
$delta4 = 4397.0*$n*$n*$n*$n/161280.0;
$Astar = $e2 + $e2*$e2 + $e2*$e2*$e2 + $e2*$e2*$e2*$e2;
$Bstar = -(7.0*$e2*$e2 + 17.0*$e2*$e2*$e2 + 30.0*$e2*$e2*$e2*$e2) / 6.0;
$Cstar = (224.0*$e2*$e2*$e2 + 889.0*$e2*$e2*$e2*$e2) / 120.0;
$Dstar = -(4279.0*$e2*$e2*$e2*$e2) / 1260.0;
// Convert.
$deg_to_rad = M_PI / 180;
$lambda_zero = $central_meridian * $deg_to_rad;
$xi = ($x - $false_northing) / ($scale * $a_roof);
$eta = ($y - $false_easting) / ($scale * $a_roof);
$xi_prim = $xi -
$delta1*sin(2.0*$xi) * cosh(2.0*$eta) -
$delta2*sin(4.0*$xi) * cosh(4.0*$eta) -
$delta3*sin(6.0*$xi) * cosh(6.0*$eta) -
$delta4*sin(8.0*$xi) * cosh(8.0*$eta);
$eta_prim = $eta -
$delta1*cos(2.0*$xi) * sinh(2.0*$eta) -
$delta2*cos(4.0*$xi) * sinh(4.0*$eta) -
$delta3*cos(6.0*$xi) * sinh(6.0*$eta) -
$delta4*cos(8.0*$xi) * sinh(8.0*$eta);
$phi_star = asin(sin($xi_prim) / cosh($eta_prim));
$delta_lambda = atan(sinh($eta_prim) / cos($xi_prim));
$lon_radian = $lambda_zero + $delta_lambda;
$lat_radian = $phi_star + sin($phi_star) * cos($phi_star) *
($Astar +
$Bstar*pow(sin($phi_star), 2) +
$Cstar*pow(sin($phi_star), 4) +
$Dstar*pow(sin($phi_star), 6));
$lat_lon[0] = $lat_radian * 180.0 / M_PI;
$lat_lon[1] = $lon_radian * 180.0 / M_PI;
//echo($lat_lon[0].",". $lat_lon[1]);
return $lat_lon;
}
$link = mysql_connect ("localhost", "root", "root123");
mysql_select_db ("supervision");
$a = " and ( ";
if($_POST['typ1'] == "1"){
$a .= "tblPositions.symbolSetId = 1 or ";
}
if($_POST['typ2'] == "1"){
$a .= "tblPositions.symbolSetId = 2 or ";
}
if($_POST['typ3'] == "1"){
$a .= "tblPositions.symbolSetId = 3 or ";
}
if($a == " and ( "){
$a = "";
}else{
$a = substr($a,0,strlen($a)-3);
$a.=")";
}
$b = " and ( ";
if($_POST['status1'] == "1"){
$b .= "tblPositions.status = 1 or ";
}
if($_POST['status2'] == "1"){
$b .= "tblPositions.status = 2 or ";
}
if($_POST['status3'] == "1"){
$b .= "tblPositions.status = 3 or ";
}
if($_POST['status4'] == "1"){
$b .= "tblPositions.status = 4 or ";
}
if($b == " and ( "){
$b = "";
}else{
$b = substr($b,0,strlen($b)-3);
$b.=")";
}
$sql = "SELECT * FROM tblSymbolSets, tblPositions WHERE tblPositions.symbolSetId = tblSymbolSets.symbolSetId ".$a . " " .$b;
$result = mysql_query($sql);
$xml .= '<?xml version="1.0" encoding="UTF-8"?>';
$xml .= '<kml xmlns="http://www.google.com/earth/kml/2">';
$xml .= '<Document>';
$xml .= '<name>Locations.kml</name>';
$x = 0;
$c = 0;
$dev_id = "";
while ($row = mysql_fetch_assoc($result)){
$list_value = $row['status'];
$arr = grid_to_geodetic($row['lat'],$row['long'],15);
//$c++;
$x++;
$xml .= '<Placemark>';
$xml .= '<name>'. $row['label'].'</name>';
$xml .= '<description><![CDATA[ INFO: <br>]]></description>';
$xml .= '<Style id="highlightPlacemark'.$x.'">';
$xml .= ' <IconStyle>';
$xml .= ' <scale>1.1</scale>';
$xml .= ' <Icon>';
if($list_value == "1"){
$xml .= ' <href>'.$row['status1url'].'</href>';
}else if($list_value == "2"){
$xml .= ' <href>'.$row['status2url'].'</href>';
}else if($list_value == "3"){
$xml .= ' <href>'.$row['status3url'].'</href>';
}else{
$xml .= ' <href>'.$row['status4url'].'</href>';
}
$xml .= ' </Icon>';
$xml .= ' </IconStyle>';
$xml .= ' </Style>';
$xml .= '<Point>';
$xml .= '<coordinates>'.$arr[1].','.$arr[0].',0</coordinates>';
$xml .= '</Point>';
$xml .= '</Placemark>';
}
$xml .= '</Document>';
$xml .= '</kml>';
$random = rand ( 1111111111 , 9999999999 );
$myFile = "data/".$random.".xml";
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, $xml);
fclose($fh);
header("Location: http://maps.google.com/maps?q=http://www.astacus.se/so/login/scripts/$myFile");
?>