mirror of
https://github.com/Schrolli91/BOSWatch.git
synced 2026-02-15 11:44:25 +01:00
Web Service, Country and Direction parsing
This commit is contained in:
parent
433e147148
commit
5b25e098e7
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
$dbhost = "localhost";
|
||||
$dbuser = "root";
|
||||
$dbpassword = "root";
|
||||
$dbpassword = "";
|
||||
$database = "boswatch";
|
||||
|
||||
$tableFMS = "bos_fms";
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<?php
|
||||
require_once ("config.php");
|
||||
|
||||
require_once ("parser.php");
|
||||
$db_link = mysqli_connect ($dbhost, $dbuser, $dbpassword, $database);
|
||||
?>
|
||||
|
||||
|
|
@ -9,34 +9,36 @@ $db_link = mysqli_connect ($dbhost, $dbuser, $dbpassword, $database);
|
|||
<html>
|
||||
<head>
|
||||
<title>BOSWatch</title>
|
||||
<link rel="stylesheet" type="text/css" href="tooltip.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div style="text-align: center; width: 1050px; margin: 0px auto;">
|
||||
<div style="text-align: center; width: 1250px; margin: 0px auto;">
|
||||
|
||||
<h1>BOSWatch</h1>
|
||||
|
||||
Last alarms for FMS and ZVEI (max. 50)<br><br>
|
||||
|
||||
<div style="float: left; width: 600px;">
|
||||
<div style="float: left; width: 800px;">
|
||||
<b>Last FMS alarms</b>
|
||||
<?php
|
||||
$sql = "SELECT id, time, service, country, location, vehicle, status, direction, tsi FROM ".$tableFMS." ORDER BY id DESC LIMIT 50";
|
||||
$db_erg = mysqli_query( $db_link, $sql );
|
||||
|
||||
|
||||
echo '<table border="1" style="width: 600px;">';
|
||||
echo '<table border="1" style="width: 800px;">';
|
||||
while ($data = mysqli_fetch_array( $db_erg, MYSQL_ASSOC))
|
||||
{
|
||||
$fms_id = $data['service'].$data['country'].$data['location'].$data['vehicle'].$data['status'].$data['direction'];
|
||||
echo "<tr>";
|
||||
echo "<td>". $data['id'] . "</td>";
|
||||
echo "<td>". $data['time'] . "</td>";
|
||||
echo "<td>". $data['service'] . "</td>";
|
||||
echo "<td>". $data['country'] . "</td>";
|
||||
echo "<td>". parse("service",$fms_id) . "</td>";
|
||||
echo "<td>". parse("country",$fms_id) . "</td>";
|
||||
echo "<td>". $data['location'] . "</td>";
|
||||
echo "<td>". $data['vehicle'] . "</td>";
|
||||
echo "<td>". $data['status'] . "</td>";
|
||||
echo "<td>". $data['direction'] . "</td>";
|
||||
echo "<td>". parse("direction",$fms_id) . "</td>";
|
||||
echo "<td>". $data['tsi'] . "</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
|
|
|
|||
69
www/parser.php
Normal file
69
www/parser.php
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
//Data from TRBOS-FMS http://www.lfs-bw.de/Fachthemen/Digitalfunk-Funk/Documents/Pruefstelle/TRBOS-FMS.pdf
|
||||
|
||||
|
||||
function parse($mode, $fms)
|
||||
{
|
||||
//Data for Service Parsing
|
||||
$service = array(
|
||||
"0" => "Unbekannt",
|
||||
"1" => "Polizei",
|
||||
"2" => "Bundesgrenzschutz",
|
||||
"3" => "Bundeskriminalamt",
|
||||
"4" => "Katastrophenschutz",
|
||||
"5" => "Zoll",
|
||||
"6" => "Feuerwehr",
|
||||
"7" => "Technisches Hilfswerk",
|
||||
"8" => "Arbeiter-Samariter-Bund",
|
||||
"9" => "Deutsches Rotes Kreuz",
|
||||
"a" => "Johanniter-Unfall-Hilfe",
|
||||
"b" => "Malteser-Hilfsdienst",
|
||||
"c" => "Deutsche Lebensrettungsgesellschaft",
|
||||
"d" => "Rettungsdienst",
|
||||
"e" => "Zivilschutz",
|
||||
"f" => "Fernwirktelegramm",
|
||||
);
|
||||
|
||||
//Data for Country Parsing
|
||||
$country = array(
|
||||
"0" => "Sachsen",
|
||||
"1" => "Bund",
|
||||
"2" => "Baden-Württemberg",
|
||||
"3" => "Bayern I",
|
||||
"4" => "Berlin",
|
||||
"5" => "Bremen",
|
||||
"6" => "Hamburg",
|
||||
"7" => "Hessen",
|
||||
"8" => "Niedersachsen",
|
||||
"9" => "Nordrhein-Westfalen",
|
||||
"a" => "Rheinland-Pflaz",
|
||||
"b" => "Schleswig-Holstein",
|
||||
"c" => "Saarland",
|
||||
"d" => "Bayern II",
|
||||
"e" => "Meck-Pom/Sachsen-Anhalt",
|
||||
"f" => "Brandenburg/Thüringen",
|
||||
);
|
||||
|
||||
switch ($mode) {
|
||||
case "service":
|
||||
return $service[substr($fms,0,1)];
|
||||
break;
|
||||
|
||||
case "country":
|
||||
return $country[substr($fms,1,1)];
|
||||
break;
|
||||
|
||||
case "direction":
|
||||
if(substr($fms,9,1) == 1){
|
||||
return "L-F";
|
||||
}elseif(substr($fms,9,1) == 0){
|
||||
return "F-L";
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return "Parser: mode error!";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
Reference in a new issue