/
getroutes_offline.php
69 lines (59 loc) · 1.48 KB
/
getroutes_offline.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
@session_start();
@ob_start();
error_reporting (E_ALL ^ E_NOTICE);
require_once("../../includes/GPSFunction.php");
//$query = 'CALL prcGetRoutes_offline("'.$_GET[sessionid].'","'.$_GET[date_offline].'")';
function get_text($filename)
{
$fp_load = @fopen("$filename", "rb");
if ( $fp_load )
{
while ( !feof($fp_load) )
{
$content .= fgets($fp_load, 102400);
}
fclose($fp_load);
return $content;
}
else
{
//header("Location:index.php?ch=dataServerConn");
}
}
function chk_folder($filename)
{
$fp_load = @fopen("$filename", "rb");
if ( $fp_load )
{
return true;
}
else
{
return false;
}
}
////////START READING DATA FROM FOLDER
$date_offline = $_GET[date_offline];
$path1=$GLOBALS[dataPath]."src/data/data_".$_SESSION[clientID]."/".date('d-m-Y',strtotime($date_offline))."/";
$matches = array();
$c=0;
preg_match_all("/(a href\=\")([^\?\"]*)(\")/i", get_text($path1), $matches);
for($i=1;$i<count($matches[2]);$i++)
{
//echo $matches[2][$i] . '<br>';
$vehicle_reg_no[$c] = explode('.',$matches[2][$i]);
$c++;
}
$xml = '<routes>';
for($i=0;$i<$c;$i++)
{
//echo $vehicle_reg_no[$i][0];
$xml.='<route sessionID="" phoneNumber="'.$vehicle_reg_no[$i][0].'" select="'.$_GET["phoneNumber"].'" date="'.$_GET["date_offline"].'" />';
}
$xml.='<route sessionID="all" phoneNumber="Show All" route="Show All" date="date_offline" select="all" />';
$xml .= '</routes>';
header('Content-Type: text/xml');
echo $xml;
//$mysqli->close();
?>