From 7108e0019ec3a01fb36b6fa89bf78ffa501b8f59 Mon Sep 17 00:00:00 2001 From: Marcel Schwarz Date: Sun, 27 May 2018 19:31:44 +0200 Subject: [PATCH] php tan corrections --- entry.php | 18 +++++++++++++----- js/{newEntry.js => entry.js} | 0 2 files changed, 13 insertions(+), 5 deletions(-) rename js/{newEntry.js => entry.js} (100%) diff --git a/entry.php b/entry.php index ae85142..5945bfe 100644 --- a/entry.php +++ b/entry.php @@ -1,9 +1,11 @@ " . $_POST['tan'] . "<-"; + if($_POST['tan'] != ""){ + addEntry(); + consumeTan($_POST['tan']); + } } function addEntry() { @@ -28,6 +30,11 @@ function consumeTan($tan) { $abfrage = "SELECT `used`, `tan` FROM `tans` WHERE `tan` = '" . $tan . "'"; $ergebnis = mysqli_query($database, $abfrage); + if($ergebnis->num_rows == 0){ + echo "Tan nicht vergeben"; + return; + } + $resultStr = ""; while ($row = $ergebnis->fetch_assoc()) { @@ -51,7 +58,7 @@ function consumeTan($tan) { - + @@ -65,7 +72,8 @@ function consumeTan($tan) {
Nachricht:

- ">
+ Tan:
+
diff --git a/js/newEntry.js b/js/entry.js similarity index 100% rename from js/newEntry.js rename to js/entry.js