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

View File

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

View File

@ -1,11 +1,20 @@
<?php <?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(); session_start();
$strLoginName=(isset($_SESSION['user'])) ? $_SESSION['user'] : "" ; $strLoginName=(isset($_SESSION['user'])) ? $_SESSION['user'] : "" ;
$boolLogin = (!empty($strLoginName)); $boolLogin = (!empty($strLoginName));
if (!$boolLogin) { if (!$boolLogin) {
header("Location: login.php"); header("Location: login.php");
} }
$dbFilename="../db/locations.db"; require_once("../config.db.php");
require ("../config.php"); require ("../config.php");
require ("../lib/geocoding.php"); require ("../lib/geocoding.php");
$boolRefresh = (isset($_GET['refresh']) & $_GET['refresh']==1); $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 = $db->prepare("SELECT * FROM files where loc_id = :loc_id");
$stmt->bindValue(":loc_id", $numDelete, PDO::PARAM_INT); $stmt->bindValue(":loc_id", $numDelete, PDO::PARAM_INT);
$result = $stmt->execute();
if ($row = $result->fetch(PDO::FETCH_ASSOC)) { if ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$strFilename = $row['filename']; $strFilename = $row['filename'];
@ -64,10 +63,11 @@
if($_GET['csrf'] !== $_SESSION['csrf_token']) { if($_GET['csrf'] !== $_SESSION['csrf_token']) {
die("Ungültiger Token"); die("Ungültiger Token");
} }
$numDelete=(int)$_GET['delfid']; $numDelete=(int)$_GET['delfid'];
$stmt = $db->prepare("SELECT * FROM files where id = :id"); $stmt = $db->prepare("SELECT * FROM files where id = :id");
$stmt->bindValue(":id", $numDelete, SQLITE3_TEXT); $stmt->bindParam(':id', $id);
$result = $stmt->execute(); //$result = $stmt->execute();
if ($row=$result->fetch(PDO::FETCH_ASSOC)) { if ($row=$result->fetch(PDO::FETCH_ASSOC)) {
$strFilename = $row['filename']; $strFilename = $row['filename'];
$strFilename = $uploaddir . $strFilename; $strFilename = $uploaddir . $strFilename;
@ -76,6 +76,7 @@
$stmt = $db->prepare("DELETE FROM files WHERE id= :id"); $stmt = $db->prepare("DELETE FROM files WHERE id= :id");
$stmt->bindValue(":id",$numDelete); $stmt->bindValue(":id",$numDelete);
$stmt->execute(); $stmt->execute();
} }
if (isset($_GET['showmap'])) { if (isset($_GET['showmap'])) {

View File

@ -7,6 +7,8 @@ $db_passwd = "g0r@w@";
$db_name = "nrw_melder"; $db_name = "nrw_melder";
$cachetime = 0; $cachetime = 0;
$location_key="8b0d633d90b501";
try { try {
$db = new PDO('mysql:host='.$db_server.';dbname='.$db_name.';charset=utf8mb4', $db_user, $db_passwd); $db = new PDO('mysql:host='.$db_server.';dbname='.$db_name.';charset=utf8mb4', $db_user, $db_passwd);
} catch (PDOException $e) {echo "Fehler: ".$e->getMessage(); die();} } 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 * Returns: data-array
* ----------------------------------------------------- */ * ----------------------------------------------------- */
//$dbFilename = "../db/locations.db";
//$db = new SQLite3($dbFilename);
require("../config.db.php");
function getAddress($lat,$lng) { function getAddress($lat,$lng) {
$key="your-key-here"; $key = $location_key;
$url="https://us1.locationiq.com/v1/reverse.php?key=".$key."&lat=".$lat."&lon=".$lng."&format=json"; $url = "https://us1.locationiq.com/v1/reverse.php?key=".$key."&lat=".$lat."&lon=".$lng."&format=json";
$curl = curl_init($url); $curl = curl_init($url);
@ -102,7 +102,6 @@ function fillAddressTable($db,$limit=20) {
$lat=$row['lat']; $lat=$row['lat'];
$lng=$row['lng']; $lng=$row['lng'];
$data=getAddress($lat,$lng); $data=getAddress($lat,$lng);
$strTable .= "<tr><td>$id</td><td>$lat</td><td>$lng</td>"; $strTable .= "<tr><td>$id</td><td>$lat</td><td>$lng</td>";
foreach ($arrKeys as $key) { foreach ($arrKeys as $key) {
$strTable .= (isset($data[$key])) ? "<td>".$data[$key]."</td>" : "<td></td>"; $strTable .= (isset($data[$key])) ? "<td>".$data[$key]."</td>" : "<td></td>";