From acec8b1120ac79318edbf2c09b3efde207f7adab Mon Sep 17 00:00:00 2001 From: /jedi/ Date: Sat, 29 Dec 2018 20:17:54 +0100 Subject: [PATCH] stash --- ajax.php | 29 ++++++++++++++++++++++++++++- index.php | 1 + templates/lost.php | 17 +++++++++++++++-- templates/page.php | 12 ++++++------ templates/request.php | 35 +++++++++++++++++++++++------------ templates/sidebar.php | 4 ++-- 6 files changed, 75 insertions(+), 23 deletions(-) diff --git a/ajax.php b/ajax.php index 274f95a..071297b 100644 --- a/ajax.php +++ b/ajax.php @@ -4,4 +4,31 @@ * User: jedi * Date: 12/28/18 * Time: 6:13 PM - */ \ No newline at end of file + */ + +include "backend.php"; + +function hasval($var){ + return isset($var) && !empty($var); +} + +switch($_GET["action"]) { + case "add_featurerequest": + if (hasval($_POST["title"]) && hasval($_POST["desc"])) { + /* Prepared statement, stage 1: prepare */ + if (!($stmt = $mysqli->prepare("INSERT INTO feature_request(title, desc) 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; +} + +echo json_encode(array("get"=>$_GET,"post"=>$_POST)); + +?> \ No newline at end of file diff --git a/index.php b/index.php index b794087..40b4736 100644 --- a/index.php +++ b/index.php @@ -76,6 +76,7 @@ function get_stats(){ if ($row = $res->fetch_assoc()) { $ret["match"] = $row["c"]; } + return $ret; } diff --git a/templates/lost.php b/templates/lost.php index 2a67963..9b7cf37 100644 --- a/templates/lost.php +++ b/templates/lost.php @@ -26,12 +26,12 @@ Insert Item into DB
-
+

">

-

+

@@ -40,7 +40,20 @@ + diff --git a/templates/page.php b/templates/page.php index cdb506d..092cd69 100644 --- a/templates/page.php +++ b/templates/page.php @@ -44,23 +44,23 @@ - +