From fef7701152048d13920b84051003c0808833ecf7 Mon Sep 17 00:00:00 2001 From: Katharina Date: Fri, 22 Feb 2019 20:47:26 +0100 Subject: [PATCH] Add Container Feature --- ajax.php | 23 +++++++++++++---------- functions.php | 2 +- templates/table.php | 34 ++++++++++++++++++---------------- 3 files changed, 32 insertions(+), 27 deletions(-) diff --git a/ajax.php b/ajax.php index 943eb5a..3409b1a 100644 --- a/ajax.php +++ b/ajax.php @@ -33,12 +33,12 @@ switch($_GET["action"]) { } break; case "add_found": - if (hasval($_POST["was"]) && hasval($_POST["wann"]) && hasval($_POST["wo"])) { + if (hasval($_POST["was"]) && hasval($_POST["wann"]) && hasval($_POST["wo"])&& hasval($_POST["container"])) { /* Prepared statement, stage 1: prepare */ - if (!($stmt = $mysqli->prepare("INSERT INTO found_items(was, wann, wo) VALUES (?, ?, ?)"))) { + if (!($stmt = $mysqli->prepare("INSERT INTO found_items(was, wann, wo, container) VALUES (?, ?, ?, ?)"))) { $errormsg = "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error; } - if (!$stmt->bind_param("sss", $_POST["was"], $_POST["wann"], $_POST["wo"])) { + if (!$stmt->bind_param("ssss", $_POST["was"], $_POST["wann"], $_POST["wo"], $_POST["container"])) { $errormsg = "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error; } if (!$stmt->execute()) { @@ -103,13 +103,13 @@ switch($_GET["action"]) { } break; case "edit_found_item": - if(hasval($_POST["id"]) && hasval($_POST["was"])) { + if(hasval($_POST["id"]) && hasval($_POST["was"])&& hasval($_POST["container"])) { /* Prepared statement, stage 1: prepare */ $was=$_POST["was"]; - if (!($stmt = $mysqli->prepare("UPDATE found_items SET was=?, wo=?, wann=? WHERE id = ?"))) { + if (!($stmt = $mysqli->prepare("UPDATE found_items SET was=?, wo=?, wann=?, container=? WHERE id = ?"))) { $errormsg = "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error; } - if (!$stmt->bind_param("sssi", $_POST["was"] , $_POST["wo"], $_POST["wann"], $_POST["id"])) { + if (!$stmt->bind_param("ssssi", $_POST["was"] , $_POST["wo"], $_POST["wann"], $_POST["container"], $_POST["id"])) { $errormsg = "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error; } if (!$stmt->execute()) { @@ -148,12 +148,12 @@ switch($_GET["action"]) { } break; case "add_found_item": - if (hasval($_POST["was"])) { + if (hasval($_POST["was"])&& hasval($_POST["container"])) { /* Prepared statement, stage 1: prepare */ - if (!($stmt = $mysqli->prepare("INSERT INTO found_items(was) VALUES (?)"))) { + if (!($stmt = $mysqli->prepare("INSERT INTO found_items(was, container) VALUES (?, ?)"))) { $errormsg = "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error; } - if (!$stmt->bind_param("s", $_POST["was"])) { + if (!$stmt->bind_param("ss", $_POST["was"], $_POST["container"])) { $errormsg = "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error; } if (!$stmt->execute()) { @@ -196,6 +196,7 @@ switch($_GET["action"]) { was wann wo + kiste foto @@ -206,6 +207,7 @@ switch($_GET["action"]) { was wann wo + kiste foto @@ -219,12 +221,13 @@ switch($_GET["action"]) { + ">
- diff --git a/functions.php b/functions.php index affdd8a..4feef5c 100644 --- a/functions.php +++ b/functions.php @@ -14,7 +14,7 @@ function auth(){ function get_founditems($onlyUnmatched = false){ global $mysqli; if ($onlyUnmatched) { - $res = $mysqli->query("SELECT distinct found_items.*, files.hash FROM (SELECT files.* from files ORDER BY files.id DESC LIMIT 100000) as files, found_items LEFT JOIN matches ON found_items.id = matches.f_id WHERE found_items.del = 0 AND files.item_id = found_items.id AND matches.f_id IS NULL GROUP BY files.item_id ORDER BY found_items.id DESC"); + $res = $mysqli->query("SELECT found_items.*, files.hash FROM (SELECT files.* from files ORDER BY files.id DESC LIMIT 100000) as files, found_items LEFT JOIN matches ON found_items.id = matches.f_id WHERE found_items.del = 0 AND files.item_id = found_items.id AND matches.f_id IS NULL GROUP BY files.item_id ORDER BY found_items.id DESC"); } else { $res = $mysqli->query("SELECT found_items.*, files.hash FROM (SELECT files.* from files ORDER BY files.id DESC LIMIT 100000) as files, found_items WHERE files.item_id = found_items.id AND found_items.del = 0 GROUP BY files.item_id ORDER BY found_items.id ASC"); } diff --git a/templates/table.php b/templates/table.php index 5f27512..59a5e2a 100644 --- a/templates/table.php +++ b/templates/table.php @@ -10,6 +10,9 @@ #img-upload{ width: 100%; } + #img-zoom{ + width: 100%; + }
@@ -53,6 +56,7 @@

+

@@ -84,9 +88,9 @@ -