diff --git a/index.php b/index.php
index 92015ab..83b2ead 100644
--- a/index.php
+++ b/index.php
@@ -44,6 +44,11 @@
+<<<<<<< HEAD
+=======
+
+
+>>>>>>> parent of 268a8ea... switched tan from unique id to index
diff --git a/js/contentloader.js b/js/contentloader.js
index a6ce3fb..3bfacba 100644
--- a/js/contentloader.js
+++ b/js/contentloader.js
@@ -1,7 +1,13 @@
window.addEventListener('load', async () => {
console.log("Seite geladen");
+<<<<<<< HEAD
getNewUniqueLink();
document.getElementById('create').addEventListener('click' , async (event) => createEntry());
+=======
+ //getNewUniqueLink();
+ document.getElementById('btnCreateTan').addEventListener('click' , async (event) => getNewUniqueLink());
+ document.getElementById('btnAbsenden').addEventListener('click' , async (event) => createEntry());
+>>>>>>> parent of 268a8ea... switched tan from unique id to index
})
async function getNewUniqueLink() {
@@ -18,7 +24,12 @@ async function getNewUniqueLink() {
}
async function createEntry() {
event.preventDefault()
+<<<<<<< HEAD
const formData = new formData(document.getElementById('create-form'));
+=======
+ console.log("Absenden gedrueckt!!!!");
+ const formData = new formData(document.getElementById('entry-form'));
+>>>>>>> parent of 268a8ea... switched tan from unique id to index
try {
const response = await fetch('php/login.php', {
diff --git a/segments/_entryForm.php b/segments/_entryForm.php
new file mode 100644
index 0000000..33436c8
--- /dev/null
+++ b/segments/_entryForm.php
@@ -0,0 +1,230 @@
+" . $_POST['tan'] . "<-";
+ if($_POST['tan'] != ""){
+ addEntry();
+ consumeTan($_POST['tan']);
+ }
+ }
+
+ function addEntry() {
+
+ }
+
+function consumeTan($tan) {
+ require('../dbConnect.php'); //Erstellt variable mit dem namen $database
+
+ //Stelle sicher dass die Tan noch verfügbar ist.
+ $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()) {
+ $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'];
+}
+
+?>
+
+
+