-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathclient.php
99 lines (82 loc) · 2.37 KB
/
client.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
require_once 'authorisation.php';
require_once 'format.php';
// Just get all the submitted variables and store for reference
$fh = fopen("/tmp/live24", "w");
foreach ($_REQUEST as $k=>$v)
{
fwrite($fh, "key=$k, value$v\n");
}
fclose($fh);
// The standard variables
$op = reqsval('op');
$link = db_connect();
$username = reqsval('username');
$password = reqsval('password');
$session = reqsval('sessionID');
$sql = "select pilPk from tblPilot where pilLastName='$username' and pilHGFA='$password'";
$result = mysql_query($sql, $link);
#if ($op eq 'login')
#{
// my $a = floor(random(System.currentTimeMillis()));
//int rnd=a.nextInt();
// we make an int with leftmost bit=1 ,
// the next 7 bits random
// (so that the same userID can have multiple active sessions)
// and the next 3 bytes the userID
//rnd=( rnd & 0x7F000000 ) | ( userID & 0x00ffffff) | 0x80000000;
#}
if ($op == 'submit')
{
$user = reqsval('liveUsername');
$id = reqsval('liveUserID');
$glidertype = reqival('gliderType');
$glider = reqival('gliderName');
$platform = reqsval('platform');
$gpsmodel = reqsval('gps');
$progname = reqsval('programName');
$progversion = reqsval('programVersion');
$comments = reqival('comments');
$userurl = reqsval('url');
$server = reqival('leonardoServer');
// Assume full re-upload
$format = $_REQUEST['format'];
$compressed = reqival('compressed');
$timestamp = reqival('firstTM');
if ($compressed)
{
// reinflate data ..
$format = http_inflate($format);
}
// Now write the differential format
$dte = date("Y-m-d_Hms");
$yr = date("Y");
$copyname = FILEDIR . $yr . "/" . $name . "_" . $hgfa . "_" . $dte;
$fh = fopen($copyname, "w");
fwrite($fh, "LIVE24\n");
fwrite($fh, "time=$timestamp\n");
fwrite($fh, $format);
fclose($fh);
$out = '';
$retv = 0;
if (!$comments)
{
$comments = 1;
}
exec(BINDIR . "add_track.pl $pilPk $copyname $comments", $out, $retv);
foreach ($out as $row)
{
if (substr_compare("traPk=6", $row, 0, 6) == 0)
{
$traPk = 0 + substr($row, 6);
break;
}
}
// Ok - update glider and any other info we have
print "added track ($traPk): $out\n";
}
else
{
print "Unknown operation: $op<br>\n";
}
?>