Compare commits

..

2 Commits

Author SHA1 Message Date
Walter Hupfeld
5fd594a103 fixes 2024-02-18 10:40:48 +01:00
Walter Hupfeld
175d82f911 fixes geocoding 2024-02-18 10:39:48 +01:00
9 changed files with 41 additions and 24 deletions

12
.gitignore vendored
View File

@ -1,14 +1,4 @@
# ---> VisualStudioCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
# Local History for Visual Studio Code
.history/
# Built Visual Studio Code Extensions
*.vsix
config.db.php

View File

@ -1,8 +1,8 @@
<?php
exit();
date_default_timezone_set('UTC');
$db = new SQLite3($dbFilename);
require("../config.db.php");
$db->exec("CREATE TABLE IF NOT EXISTS location(
id INTEGER PRIMARY KEY AUTOINCREMENT,

View File

@ -6,6 +6,7 @@
* E-Mail: info@hupfeld-software.de
* Version: 1.0
* Datum: 18.05.2021
* zuletzt geändert: 18.02.2024
******************************** */
session_start();
@ -14,7 +15,8 @@
if (!$boolLogin) {
header("Location: login.php");
}
$dbFilename="../db/locations.db";
require("../config.db.php");
require ("../config.php");
// Set headers to make the browser download the results as a csv file

View File

@ -6,6 +6,7 @@
* E-Mail: info@hupfeld-software.de
* Version: 1.0
* Datum: 18.05.2021
* zuletzt geändert: 18.02.2024
******************************** */
session_start();
@ -14,7 +15,6 @@
if (!$boolLogin) {
header("Location: login.php");
}
$dbFilename="../db/locations.db";
require ("../config.php");
?>
<!DOCTYPE html>

View File

@ -1,11 +1,20 @@
<?php
/** *****************************
* Ideenmelder
* Autor: Walter Hupfeld, Hamm
* E-Mail: info@hupfeld-software.de
* Version: 1.0
* Datum: 18.05.2021
* zuletzt geändert: 18.02.2024
*/
session_start();
$strLoginName=(isset($_SESSION['user'])) ? $_SESSION['user'] : "" ;
$boolLogin = (!empty($strLoginName));
if (!$boolLogin) {
header("Location: login.php");
}
$dbFilename="../db/locations.db";
require_once("../config.db.php");
require ("../config.php");
require ("../lib/geocoding.php");
$boolRefresh = (isset($_GET['refresh']) & $_GET['refresh']==1);

View File

@ -36,7 +36,6 @@
$stmt = $db->prepare("SELECT * FROM files where loc_id = :loc_id");
$stmt->bindValue(":loc_id", $numDelete, PDO::PARAM_INT);
$result = $stmt->execute();
if ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$strFilename = $row['filename'];
@ -64,10 +63,11 @@
if($_GET['csrf'] !== $_SESSION['csrf_token']) {
die("Ungültiger Token");
}
$numDelete=(int)$_GET['delfid'];
$stmt = $db->prepare("SELECT * FROM files where id = :id");
$stmt->bindValue(":id", $numDelete, SQLITE3_TEXT);
$result = $stmt->execute();
$stmt->bindParam(':id', $id);
//$result = $stmt->execute();
if ($row=$result->fetch(PDO::FETCH_ASSOC)) {
$strFilename = $row['filename'];
$strFilename = $uploaddir . $strFilename;
@ -76,6 +76,7 @@
$stmt = $db->prepare("DELETE FROM files WHERE id= :id");
$stmt->bindValue(":id",$numDelete);
$stmt->execute();
}
if (isset($_GET['showmap'])) {

View File

@ -7,6 +7,8 @@ $db_passwd = "g0r@w@";
$db_name = "nrw_melder";
$cachetime = 0;
$location_key="8b0d633d90b501";
try {
$db = new PDO('mysql:host='.$db_server.';dbname='.$db_name.';charset=utf8mb4', $db_user, $db_passwd);
} catch (PDOException $e) {echo "Fehler: ".$e->getMessage(); die();}

14
config.db.php.sample Normal file
View File

@ -0,0 +1,14 @@
<?
$db_server = "mariadb";
$db_user = "";
$db_passwd = "";
$db_name = "nrw_melder";
$cachetime = 0;
$location_key="";
try {
$db = new PDO('mysql:host='.$db_server.';dbname='.$db_name.';charset=utf8mb4', $db_user, $db_passwd);
} catch (PDOException $e) {echo "Fehler: ".$e->getMessage(); die();}

View File

@ -7,14 +7,14 @@
* Returns: data-array
* ----------------------------------------------------- */
//$dbFilename = "../db/locations.db";
//$db = new SQLite3($dbFilename);
require("../config.db.php");
function getAddress($lat,$lng) {
$key="your-key-here";
$url="https://us1.locationiq.com/v1/reverse.php?key=".$key."&lat=".$lat."&lon=".$lng."&format=json";
$key = $location_key;
$url = "https://us1.locationiq.com/v1/reverse.php?key=".$key."&lat=".$lat."&lon=".$lng."&format=json";
$curl = curl_init($url);
@ -102,7 +102,6 @@ function fillAddressTable($db,$limit=20) {
$lat=$row['lat'];
$lng=$row['lng'];
$data=getAddress($lat,$lng);
$strTable .= "<tr><td>$id</td><td>$lat</td><td>$lng</td>";
foreach ($arrKeys as $key) {
$strTable .= (isset($data[$key])) ? "<td>".$data[$key]."</td>" : "<td></td>";