generic start

This commit is contained in:
Walter Hupfeld 2021-10-27 15:01:27 +02:00
parent 4c54b396ac
commit e958343004
12 changed files with 86 additions and 17 deletions

View File

@ -3,3 +3,10 @@
RedirectMatch 404 /\.git RedirectMatch 404 /\.git
RedirectMatch 404 /db RedirectMatch 404 /db
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(.*)$ index.php?d=$1 [QSA]

View File

@ -8,20 +8,17 @@ date_default_timezone_set('UTC');
$db_server = "mariadb"; $db_server = "mariadb";
$db_user = "unfallstatistik"; $db_user = "unfallstatistik";
$db_passwd = "BCJloVozJbdDHQTS"; $db_passwd = "BCJloVozJbdDHQTS";
$db_server = "localhost";
$db_user = "root";
$db_passwd = "g0r@w@";
$db = "unfallstatistik"; $db = "unfallstatistik";
try { try {
$db = new PDO('mysql:host='.$db_server.';dbname='.$db.';charset=utf8mb4', $db_user, $db_passwd); $db = new PDO('mysql:host='.$db_server.';dbname='.$db.';charset=utf8mb4', $db_user, $db_passwd);
} catch (PDOException $e) {echo "Fehler: ".$e->getMessage(); die();} } catch (PDOException $e) {echo "Fehler: ".$e->getMessage(); die();}
$strTitle = "Unfallkarte Soest ";
$strIntroText = "Unfallkarte für die Stadt Soest basierend auf den Daten des Statistischen Bundesamtes.";
$numInfoLat =51.5718;
$numInfoLng =8.10716;
$numZoom=12;
$fileGeojson ="geojson/soest.geojson";
$strLocation = " AND ULAND=5 AND UREGBEZ=9 AND UKREIS=74 AND UGEMEINDE=40 ";
$arrVehicles = array ( $arrVehicles = array (
1 => "Fahrrad", 1 => "Fahrrad",

1
geojson/bochum.geojson Normal file

File diff suppressed because one or more lines are too long

1
geojson/dortmund.geojson Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1
geojson/essen.geojson Normal file

File diff suppressed because one or more lines are too long

1
geojson/marl.geojson Normal file

File diff suppressed because one or more lines are too long

BIN
geojson/mbl26-3anlage8.pdf Normal file

Binary file not shown.

1
geojson/muenster.geojson Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -3,12 +3,60 @@
require("config.php"); require("config.php");
require_once("lib/functions.php"); require_once("lib/functions.php");
$strIntro ="<h4>".$strTitle."</h4>"; $numYear="2020";
$strIntro .= nl2br2($strIntroText);
$numYear=2020; $strDistrict = (isset($_GET['d'])) ? $_GET['d'] : "Hamm";
$numVehicle = (isset($_GET['v'])) ? (int) $_GET['v'] : 1; $numVehicle = (isset($_GET['v'])) ? (int) $_GET['v'] : 1;
$numYear = (isset($_GET['year'])) ? (int) $_GET['year'] : $numYear; $numYear = (isset($_GET['year'])) ? (int) $_GET['year'] : $numYear;
$result= $db->prepare("SELECT count(*) FROM district WHERE district=:district");
$result->bindParam(":district",$strDistrict);
$result->execute();
if ($row=$result->fetch(PDO::FETCH_NUM)) {
if ($row[0]==0) $strDistrict="hamm";
}
//$result = $db->query($strSQL);
$result= $db->prepare("SELECT * FROM district WHERE district=:district");
$result->bindParam(":district",$strDistrict);
$result->execute();
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$strDistrict = $row['district'];
$strTitle = $row['title'];
$strGeojson = $row['geojson'];
$numULAND=$row['ULAND'];
$numUREGBEZ=$row['UREGBEZ'];
$numUKREIS=$row['UKREIS'];
$numUGEMEINDE=$row['UGEMEINDE'];
$numInfoLat=$row['lat'];
$numInfoLng=$row['lng'];
$numZoom=$row['zoom'];
$strTitle = "Unfallkarte $strTitle ";
$strIntroText = "Unfallkarte für die Stadt $strTitle basierend auf den Daten des Statistischen Bundesamtes.";
$fileGeojson ="geojson/$strGeojson";
$strLocation = " AND ULAND=$numULAND AND UREGBEZ=$numUREGBEZ AND UKREIS=$numUKREIS ";
if ($numUGEMEINDE>0) {
$strLocation .= "AND UGEMEINDE=$numUGEMEINDE";
}
}
$arrDisctrict = array ();
$strSQL = "SELECT district,title FROM district ORDER BY title ASC";
$result=$db->query($strSQL);
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$arrDistrict[$row['district']]=$row['title'];
}
$strIntro ="<h4>".$strTitle."</h4>";
$strIntro .= nl2br2($strIntroText);
switch ($numVehicle) { switch ($numVehicle) {
case 1: case 1:
@ -43,7 +91,6 @@
$strYear = " AND UJAHR='".$numYear."' "; $strYear = " AND UJAHR='".$numYear."' ";
$strSQL="SELECT * FROM data WHERE ".$strWhere.$strYear.$strLocation; $strSQL="SELECT * FROM data WHERE ".$strWhere.$strYear.$strLocation;
echo $strSQL;
$result = $db->query($strSQL); $result = $db->query($strSQL);
@ -101,8 +148,8 @@
<!-- Navbar --> <!-- Navbar -->
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top"> <nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
<a class="navbar-brand" href="#"><?= $strTitle ?></a> <a class="navbar-brand" href="#"><?= $strTitle ?></a>
<a class="navbar-brand" href="index.php?year=2019&v=<?=$numVehicle?>">2019</a> <a class="navbar-brand" href="index.php?year=2019&v=<?=$numVehicle?>&d=<?=$strDistrict?>">2019</a>
<a class="navbar-brand" href="index.php?year=2020&v=<?=$numVehicle?>">2020</a> <a class="navbar-brand" href="index.php?year=2020&v=<?=$numVehicle?>&d=<?=$strDistrict?>">2020</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbars" aria-controls="navbars" aria-expanded="false" aria-label="Toggle navigation"> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbars" aria-controls="navbars" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
@ -115,13 +162,21 @@
?> ?>
<li class="nav-item <?=$strActive?>"> <li class="nav-item <?=$strActive?>">
<a class="nav-link" href="index.php?v=<?=$key?>&year=<?=$numYear?>"><?=$strVehicle?> <a class="nav-link" href="index.php?v=<?=$key?>&year=<?=$numYear?>&d=<?=$strDistrict?>"><?=$strVehicle?>
<span class="sr-only">(current)</span> </a> <span class="sr-only">(current)</span> </a>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
<div> <div>
<form method="GET" action="index.php">
<select name="d" style="float:left;margin-top:0.5em;margin-right:0.5em;" onchange="this.form.submit()">
<?php foreach ($arrDistrict as $key => $strTitle):
$strActive = ($strDistrict==$key) ? "selected=\"selected\"" : ""; ?>
<option value="<?=$key?>" <?=$strActive?>><?=$strTitle?></option>
<?php endforeach; ?>
</select>
</from>
<ul class="navbar-nav mr-auto right"> <ul class="navbar-nav mr-auto right">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="impressum.php">Impressum</a> <a class="nav-link" href="impressum.php">Impressum</a>
@ -263,7 +318,9 @@
}) })
function myFunction(chosen) {
console.log(chosen);
}
</script> </script>