diff --git a/action.php b/action.php new file mode 100644 index 0000000..cd58776 --- /dev/null +++ b/action.php @@ -0,0 +1,49 @@ +prepare("INSERT INTO items(was, wann, wo) VALUES (?, ?, ?)"))) { + echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error; + } + if (!$stmt->bind_param("sss", $_POST["was"], $_POST["wann"], $_POST["wo"])) { + echo "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error; + } + if (!$stmt->execute()) { + echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error; + } + } + + break; + case "lost": + if (hasval($_POST["was"]) && hasval($_POST["wann"]) && hasval($_POST["wo"]) && hasval($_POST["contact"])) { + /* Prepared statement, stage 1: prepare */ + if (!($stmt = $mysqli->prepare("INSERT INTO lost(was, wann, wo, contact) VALUES (?, ?, ?, ?)"))) { + echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error; + } + if (!$stmt->bind_param("ssss", $_POST["was"], $_POST["wann"], $_POST["wo"], $_POST["contact"])) { + echo "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error; + } + if (!$stmt->execute()) { + echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error; + } + } + break; + +} +header('Location: '.$_SERVER['HTTP_REFERER']); + +?> \ No newline at end of file diff --git a/backend.php b/backend.php new file mode 100644 index 0000000..a83492f --- /dev/null +++ b/backend.php @@ -0,0 +1,12 @@ +connect_errno) { + echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; +} +?> \ No newline at end of file diff --git a/404.html b/demo/404.html similarity index 92% rename from 404.html rename to demo/404.html index 5a7f45e..7150e6f 100644 --- a/404.html +++ b/demo/404.html @@ -12,16 +12,16 @@