diff --git a/entry.php b/entry.php index f77fb29..ae85142 100644 --- a/entry.php +++ b/entry.php @@ -1,4 +1,53 @@ +connect_error) { + die('Connect Error (' . $database->connect_errno . ') ' . $database->connect_error); + } + + //Stelle sicher dass die Tan noch verfügbar ist. + $abfrage = "SELECT `used`, `tan` FROM `tans` WHERE `tan` = '" . $tan . "'"; + $ergebnis = mysqli_query($database, $abfrage); + + $resultStr = ""; + + while ($row = $ergebnis->fetch_assoc()) { + $resultStr = $resultStr . $row["used"] . ' ' . $row["tan"] . '
'; + if($row["used"] == 1){ + echo "Tan schon verbraucht"; + return; + } + + } + + //echo $resultStr; + + //Setzte Tan auf verbraucht + $update = $database->query("UPDATE `tans` SET `used`= true WHERE `tan` = '" . $_POST['tan'] . "'"); + + echo "Tan verbraucht " . $_POST['tan']; +} + +?> @@ -7,7 +56,7 @@ -
+ Vorname:

Nachname:
diff --git a/php/addEntry.php b/php/addEntry.php deleted file mode 100644 index 0f6b119..0000000 --- a/php/addEntry.php +++ /dev/null @@ -1,32 +0,0 @@ -connect_error) { - die('Connect Error (' . $database->connect_errno . ') ' . $database->connect_error); - } - - $update = $database->query("UPDATE `tans` SET `used`= true WHERE `tan` = '" . $_POST['tan'] . "'"); - - -} - - -?> diff --git a/php/generateLink.php b/php/generateLink.php index e9d0332..03f9e7e 100644 --- a/php/generateLink.php +++ b/php/generateLink.php @@ -2,6 +2,8 @@ $uniqueID = uniqid(); $resultStr = "Neuer eintrag über: http://localhost/github/ipr-projekt/entry.php?tan="; + //Final link + //$resultStr = "Neuer eintrag über: http://localhost/friendsbook/entry.php?tan="; $resultStr = $resultStr . $uniqueID; insertTan($uniqueID);