????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.217.114 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/ |
Upload File : |
<?php
session_start();
if( (($_SESSION['SUPERVISION_SSO_INFO'])=='' )){
header('location: https://www.supervision-online.se/loggain.php');
}
$link = mysql_connect ("localhost", "root", "root123");
mysql_select_db ("supervision");
$a = "";
for($i = 1; $i < $_POST['nbrSets'];$i++){
if($_POST['typ'.$i] != ""){
$a .= "tblPositions.symbolSetId = ".$_POST['typ'.$i]." or ";
}
}
$sql = "SELECT * FROM tblSymbolSets, tblPositions WHERE tblPositions.symbolSetId = tblSymbolSets.symbolSetId and (".$a;
$sql = substr($sql,0,strlen($sql)-4).")";
$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 = " and tblPositions.status = 0 ";
}else{
$b = substr($b,0,strlen($b)-3);
$b.=")";
}
// echo($sql);
$result = mysql_query($sql.$b);
$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)){
$status = $row['status'];
$label = $row['label'];
$description = $row['description'];
if($status == "1"){
$status_text = "Fungerar";
}else if($status == "2"){
$status_text = "Defekt";
}else if($status == "3"){
$status_text = "Tillsyn krävs";
}else{
$status_text = "Nytillagd";
}
//$c++;
$x++;
$xml .= '<Placemark>';
$xml .= '<name>'.$label.' ('.$description.')</name>';
if($_POST['short'] == "1"){
$xml .= '<description><![CDATA[Nuvarande status: '.$status_text.'. <br><br><a href="https://www.supervision-online.se/login/scripts/googlemaps/showAnswers.php?positionid='.$row['id'].'&symbolSetId='.$row['symbolSetId'].'" target="_new"> - Öppna svar</a> ]]></description>';
}else{
$xml .= '<description>'.$status_text.'</description>';
$xml .= '<positionid>'.$row['id'].'</positionid>';
$xml .= '<symbolSetId>'.$row['symbolSetId'].'</symbolSetId>';
$xml .= '<label>'.$row['label'].'</label>';
$xml .= '<pname>'.$row['name'].'</pname>';
}
$xml .= '<Style id="highlightPlacemark'.$x.'">';
$xml .= ' <IconStyle>';
$xml .= ' <scale>5</scale>';
$xml .= ' <Icon>';
if($status == "1"){
$xml .= ' <href>'.$row['status1url'].'</href>';
}else if($status == "2"){
$xml .= ' <href>'.$row['status2url'].'</href>';
}else if($status == "3"){
$xml .= ' <href>'.$row['status3url'].'</href>';
}else{
$xml .= ' <href>'.$row['status4url'].'</href>';
}
$xml .= ' </Icon>';
$xml .= ' </IconStyle>';
$xml .= ' </Style>';
$xml .= '<Point>';
$xml .= '<coordinates>'.$row['pos_long'].','.$row['pos_lat'].',0</coordinates>';
$xml .= '</Point>';
$xml .= '</Placemark>';
}
if($_POST['ipad'] == "1"){
$sql = "SELECT * FROM tblUsers where companyId = ".$_SESSION['SUPERVISION_SSO_INFO'][1]." and (not userlat = 0 and not userlong = 0)";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)){
$x++;
$xml .= '<Placemark>';
$xml .= '<name>User '.$row['username'].'</name>';
$xml .= '<description><![CDATA[ INFO: '.$row['username'].'<br>'.$row['userlat'].','.$row['userlong'].' <br>]]></description>';
$xml .= '<Style id="highlightPlacemark'.$x.'">';
$xml .= ' <IconStyle>';
$xml .= ' <scale>5</scale>';
$xml .= ' <Icon>';
$xml .= ' <href>http://www.supervision-online.se/images/placemarks/ipad.png</href>';
$xml .= ' </Icon>';
$xml .= ' </IconStyle>';
$xml .= ' </Style>';
$xml .= '<Point>';
$xml .= '<coordinates>'.$row['userlong'].','.$row['userlat'].',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);
class XmlToJson {
public function Parse ($url) {
$fileContents= file_get_contents_utf8($url);
$fileContents = str_replace(array("\n", "\r", "\t"), '', $fileContents);
$fileContents = trim(str_replace('"', "'", $fileContents));
$simpleXml = simplexml_load_string($fileContents);
$json = json_encode($simpleXml);
return $json;
}
}
function file_get_contents_utf8($fn) {
$content = file_get_contents($fn);
return mb_convert_encoding($content, 'UTF-8',
mb_detect_encoding($content, 'UTF-8, ISO-8859-1', true));
}
$xml_json = XmlToJson::Parse("http://www.supervision-online.se/login/$myFile");
$random = rand ( 1111111111 , 9999999999 );
$myFile = "GOOGLE/data/".$random.".json";
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, "var data2 = " . $xml_json);
fclose($fh);
header("Location: http://www.supervision-online.se/login/GOOGLE/Index.php?filename=/data/".$random.".json");
?>