-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathmerge_track.php
More file actions
48 lines (38 loc) · 1.45 KB
/
Copy pathmerge_track.php
File metadata and controls
48 lines (38 loc) · 1.45 KB
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
<?php
require 'authorisation.php';
require 'xcdb.php';
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: application/json');
$link = db_connect();
$comPk = intval($_REQUEST['comPk']);
$tasPk = intval($_REQUEST['tasPk']);
$traPk = intval($_REQUEST['traPk']);
$incPk = intval($_REQUEST['incPk']);
if ($comPk == 0)
{
$sql = "select comPk from tblTask where tasPk=$tasPk";
$result = mysqli_query($link, $sql) or die('Error ' . mysqli_errno($link) . ' can' . mysqli_connect_error());
$comPk = mysqli_result($result,0,0);
}
// authorise ...
$usePk = check_auth('system');
$link = db_connect();
$isadmin = is_admin('admin',$usePk,$comPk);
if (!$isadmin)
{
return 0;
}
#$sql = "insert into tblTrackLog ( trlLatDecimal, trlLongDecimal, trlAltitude, trlTime )
#select $traPk, trlLatDecimal, trlLongDecimal, trlAltitude, trlTime* from tblTrackLog where traPk in $incPk";
$sql = "update tblTrackLog set traPk=$traPk where traPk=$incPk";
$result = mysqli_query($link, $sql) or die('Error ' . mysqli_errno($link) . ' cannot merge track' . mysqli_connect_error());
$sql = "delete from tblTrack where traPk=$incPk";
$result = mysqli_query($link, $sql) or die('Error ' . mysqli_errno($link) . ' cannot delete merged track' . mysqli_connect_error());
// Re-verify
$out = '';
$retv = 0;
exec(BINDIR . "track_verify_sr.pl $traPk $tasPk", $out, $retv);
mysqli_close($link);
//print json_encode($retarr);
?>