From a16f693a1a874dbbff306aa8fed00fdf7d0b87c2 Mon Sep 17 00:00:00 2001 From: Baptiste Date: Fri, 21 Jan 2022 02:50:15 +0100 Subject: [PATCH] .htpassdb + tentative map --- assets/map/map.php | 43 ++++++++++++++++++++++++++++++++++++++++--- script/.htpassdb | 0 script/db.php | 12 ++++++++++++ 3 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 script/.htpassdb diff --git a/assets/map/map.php b/assets/map/map.php index f17a114..bac8785 100644 --- a/assets/map/map.php +++ b/assets/map/map.php @@ -4,6 +4,45 @@ } + + +conn->prepare($sql); + $cursor->execute([$selector]); + return $cursor->fetchAll(PDO::FETCH_ASSOC); +} + +function get_map_selectors() +{ + $sql = 'SELECT selector FROM map_insa'; + $cursor = $this->conn->prepare($sql); + $cursor->execute(); + return $cursor->fetchAll(PDO::FETCH_ASSOC); +} + +function save_map_info($selector, $info_json) +{ + $sql = 'DELETE FROM map_insa WHERE selector = ?'; + $cursor = $this->conn->prepare($sql); + $cursor->execute([$selector]); + $sql = 'INSERT INTO map_insa (title, description, selector) VALUES (?, ?, ?)'; + $cursor = $this->conn->prepare($sql); + $cursor->execute([$info_json['title'], $info_json['description'], $selector]); +} + +function is_in_map($selector) { + $sql = 'SELECT selector FROM map_insa WHERE selector = ?'; + $query = $this->conn->prepare($sql); + $query->execute([$selector]); + return $query->fetchAll(PDO::FETCH_ASSOC); +} + +?> +
@@ -39,6 +78,4 @@ function enable2DMap() { map3d.classList.add("hidden"); map.classList.remove("hidden"); } - - - \ No newline at end of file + \ No newline at end of file diff --git a/script/.htpassdb b/script/.htpassdb new file mode 100644 index 0000000..e69de29 diff --git a/script/db.php b/script/db.php index e69de29..cd3f823 100644 --- a/script/db.php +++ b/script/db.php @@ -0,0 +1,12 @@ + \ No newline at end of file