-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdetails.php
More file actions
230 lines (195 loc) · 7.85 KB
/
details.php
File metadata and controls
230 lines (195 loc) · 7.85 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
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<?php
/******************************************************************************************
This file is a part of SIMPLE WEB STATICSTICS GENERATOR FROM APRX LOG FILE
It's very simple and small APRX statictics generator in PHP. It's parted to smaller files and they will work independent from each other (but you always need chgif.php).
This script may have a lot of bugs, problems and it's written in very non-efficient way without a lot of good programming rules. But it works for me.
Author: Peter SQ8VPS, sq8vps[--at--]gmail.com & Alfredo IZ7BOJ
You can modify this program, but please give a credit to original author. Program is free for non-commercial use only.
(C) Peter SQ8VPS & Alfredo IZ7BOJ 2017-2018
*******************************************************************************************/
include 'config.php';
include 'common.php';
include 'functions.php';
logexists();
session_start();
if(!isset($_SESSION['if'])) //if not in session
{
header('Refresh: 0; url=chgif.php?chgif=1'); //go to the interface change page
die();
}
$call = $_SESSION['call'];
$callraw = $_SESSION['if'];
$lang = $_SESSION['lang'];
$posframefound = 0; //true if position frame of the station already found
$otherframefound = 0; //true if any other frame of the station already found
$scall = "";
$noofframes = 0;
$posdate = "";
$postime = "";
$otherdate = "";
$othertime = "";
$posframe = "";
$otherframe = "";
$lastpath = "";
$symboltab = "";
$symbol = "";
$comment = "";
$status = "";
$distance = 0;
$bearing = 0;
$mice = 0;
$declat = 0;
$declon = 0;
$tocall = "";
if(isset($_GET['getcall']) && ($_GET['getcall'] != ""))
{
$scall = strtoupper($_GET['getcall']);
$logfile = file($logpath); //read log file
$linesinlog = count($logfile);
$lines = $linesinlog - 1;
while ($lines > 0) { //read line by line but starting from the newest frame!
$line = $logfile[$lines];
if((strpos($line, $callraw." R ")!== false)OR(strpos($line, $callraw." d ")!== false)) {
frameparse($line);
}
$lines--;
}
device();
}
if($lang == "en")
{
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Description" content="APRX statistics" />
<meta name="Keywords" content="" />
<meta name="Author" content="SQ8VPS" />
<title>APRX statistics - stations' info</title>
</head>
<body>
<?php
if(file_exists($logourl)){
?>
<center><img src="<?php echo $logourl ?>" width="100px" height="100px" align="middle"></center><br>
<?php
}
?>
<center><font size="20"><b>APRX statistics</b></font>
<h2>for interface <font color="red"><b><?php echo $call; ?></b></font> - station's details</h2> <a href="chgif.php?chgif=1">Change interface</a>
<br>
<br><b>Show:</b> <a href="summary.php">Summary (main)</a> - <a href="frames.php">RAW frames from specified station</a> - <a href="details.php">Details of a specified station</a><br><br>
<hr>
</center>
<br>
<form action="details.php" method="get">
Show details of station: <input type="text" name="getcall" <?php if(isset($_GET['getcall'])) echo 'value="'.$_GET['getcall'].'"'; ?>>
<input type="submit" value="Show">
</form>
<br>
<?php
if(isset($_GET['getcall']) && ($_GET['getcall'] != ""))
{
if(($posframefound == 0) && ($otherframefound == 0))
{
echo '<font size="6">No frames found for station <b>'.$scall.'</b>.</font>';
}
else
{
echo '<b><font color="blue" size="8">'.$scall.'</font></b>';
echo '<br><a href="https://aprs.fi/?call='.$scall.'" target="_blank">Show on aprs.fi</a><br><br>';
echo '<b>Frames heard: </b><a href="frames.php?getcall='.$_GET['getcall'].'" target="_blank">'.$noofframes.'</a><br>';
if($posframefound)
{
echo '<br><br><font color="blue"><b>Last position frame heard:</b> '.$posdate.' '.$postime.' GMT (';
$dc = time() -date('Z') - strtotime($posdate.' '.$postime);
echo (int)($dc / 86400).'d '.(int)(($dc % 86400) / 3600).'h '.(int)(($dc % 3600) / 60).'m '.(int)($dc % 60).'s ago)</font>';
echo '<br><font color="red"><b>Station position: </b>'.$declat.', '.$declon.' - <b>'.$distance.' km '.$bearing.'° from your location</b></font>';
echo '<br><font color="green"><b>Frame comment: </b>'.$comment.'</font>';
echo '<br><br><b>Frame type:</b> ';
if($mice) echo 'Mic-E compressed frame'; else echo 'Uncompressed frame';
echo '<br><b>Station symbol:</b> '.$symboltab.$symbol;
echo '<br><b>Frame path:</b> '.$scall.'>'.$lastpath;
echo '<br><b>Device:</b> '.$device;
}
if($otherframefound)
{
echo '<br><br><b>Last status frame heard:</b> '.$otherdate.' '.$othertime.' (';
$dc = time() - strtotime($otherdate.' '.$othertime);
echo (int)($dc / 86400).'d '.(int)(($dc % 86400) / 3600).'h '.(int)(($dc % 3600) / 60).'m '.(int)($dc % 60).'s ago)';
echo '<br><b>Status: </b>'.$status;
}
}
}
}else {
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Description" content="Statystyki APRX" />
<meta name="Keywords" content="" />
<meta name="Author" content="SQ8VPS" />
<title>Statystyki APRX - informacje o stacjach</title>
</head>
<body>
<?php
if(file_exists($logourl)){
?>
<center><img src="<?php echo $logourl ?>" width="100px" height="100px" align="middle"></center><br>
<?php
}
?>
<center><font size="20"><b>Statystyki APRX</b></font>
<h2>dla interfejsu <font color="red"><b><?php echo $call; ?></b></font> - szczegóły stacji</h2> <a href="chgif.php?chgif=1">Zmień interfejs</a>
<br>
<br><b>Pokaż:</b> <a href="summary.php">Podsumowanie (główna)</a> - <a href="frames.php">Surowe ramki wybranej stacji</a> - <a href="details.php">Szczegóły wybranej stacji</a><br><br>
<hr>
</center>
<br>
<form action="details.php" method="get">
Pokaż szczegóły stacji: <input type="text" name="getcall" <?php if(isset($_GET['getcall'])) echo 'value="'.$_GET['getcall'].'"'; ?>>
<input type="submit" value="Pokaż">
</form>
<br>
<?php
if(isset($_GET['getcall']) && ($_GET['getcall'] != ""))
{
if(($posframefound == 0) && ($otherframefound == 0))
{
echo '<font size="6">Brak odebranych ramek od stacji <b>'.$scall.'</b>.</font>';
}
else
{
echo '<b><font color="blue" size="8">'.$scall.'</font></b>';
echo '<br><a href="https://aprs.fi/?call='.$scall.'" target="_blank">Pokaż na aprs.fi</a><br><br>';
echo '<b>Frames heard: </b><a href="frames.php?getcall='.$_GET['getcall'].'" target="_blank">'.$noofframes.'</a><br>';
if($posframefound)
{
echo '<br><br><font color="blue"><b>Ostatnia ramka z pozycją:</b> '.$posdate.' '.$postime.' GMT (';
$dc = time() -date('Z') - strtotime($posdate.' '.$postime);
echo (int)($dc / 86400).'d '.(int)(($dc % 86400) / 3600).'h '.(int)(($dc % 3600) / 60).'m '.(int)($dc % 60).'s ago)</font>';
echo '<br><font color="red"><b>Pozycja: </b>'.$declat.', '.$declon.' - <b>'.$distance.' km '.$bearing.'° od twojej lokalizacji</b></font>';
echo '<br><font color="green"><b>Komentarz: </b>'.$comment.'</font>';
echo '<br><br><b>Typ ramki:</b> ';
if($mice) echo 'Ramka skompresowana Mic-E'; else echo 'Ramka nieskompresowana';
echo '<br><b>Symbol:</b> '.$symboltab.$symbol;
echo '<br><b>Ścieżka:</b> '.$scall.'>'.$lastpath;
echo '<br><b>Urządzenie:</b> '.$device;
}
if($otherframefound)
{
echo '<br><br><b>Ostatnia ramka statusu:</b> '.$otherdate.' '.$othertime.' (';
$dc = time() - strtotime($otherdate.' '.$othertime);
echo (int)($dc / 86400).'d '.(int)(($dc % 86400) / 3600).'h '.(int)(($dc % 3600) / 60).'m '.(int)($dc % 60).'s ago)';
echo '<br><b>Status: </b>'.$status;
}
}
}
}
?>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<center><a href="https://github.com/sq8vps/aprx-simplewebstat" target="_blank">APRX Simple Webstat version <?php echo $asw_version; ?></a> by Peter SQ8VPS and Alfredo IZ7BOJ</center>
</body>
</html>