aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-05-21 16:37:29 +0200
committerlonkaars <loek@pipeframe.xyz>2023-05-21 16:37:29 +0200
commit690516d932e6894938622472222cdfcb06740a83 (patch)
tree13c9488bde811d84748ffa0dfcd72297ad7819dd
parent1bb67296c43b662cf00882971fcb3df655d7302b (diff)
place order
-rw-r--r--public/cart.php2
-rw-r--r--public/order-complete.php42
2 files changed, 44 insertions, 0 deletions
diff --git a/public/cart.php b/public/cart.php
index d4dfcc6..f3b9b5e 100644
--- a/public/cart.php
+++ b/public/cart.php
@@ -12,6 +12,7 @@
$statement = $cursor->prepare("delete from orderproduct where product = ? and `order` = cart(?)");
$statement->bind_param("ii", $_POST['product_id'], $user_id);
$statement->execute();
+ $cart_count = get_cart_count();
break;
}
case "add": {
@@ -23,6 +24,7 @@
$statement->bind_param("ii", $_POST['product_id'], $user_id);
$statement->execute();
$statement->get_result()/*->fetch_object()*/;
+ $cart_count = get_cart_count();
break;
}
}
diff --git a/public/order-complete.php b/public/order-complete.php
new file mode 100644
index 0000000..a455048
--- /dev/null
+++ b/public/order-complete.php
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<?php require "../lib/db.php" ?>
+<?php require "../lib/login.php" ?>
+<?php if_logged_in(false, "/login.php", true) ?>
+<?php do {
+ if ($_SERVER['REQUEST_METHOD'] !== 'POST') break;
+
+ $cart_id = 0;
+
+ $statement = $cursor->prepare("select cart(?) as cart_id");
+ $statement->bind_param("i", $user_id);
+ if (!$statement->execute()) break;
+ $res = $statement->get_result();
+ if (!mysqli_num_rows($res)) break;
+ $cart_id = $res->fetch_object()->cart_id;
+
+ $statement = $cursor->prepare("select id from orderproduct where `order` = ?");
+ $statement->bind_param("i", $cart_id);
+ if (!$statement->execute()) break;
+ $res = $statement->get_result();
+ if (!mysqli_num_rows($res)) break;
+
+ $statement = $cursor->prepare("update `order` set status = 2 where id = ?");
+ $statement->bind_param("i", $cart_id);
+ if (!$statement->execute()) break;
+ $cart_count = get_cart_count();
+} while (false); ?>
+<html>
+<head>
+ <?php include 'head.php' ?>
+ <title>bestelling afgerond</title>
+</head>
+<body>
+ <?php include 'navbar.php' ?>
+ <div class="main limwidth">
+ <h2>Bestelling succesvol afgerond</h2>
+ <p>nu krijg je weer zo'n vervelende e-mail waarin staat wat je net hebt gedaan alsof je het gelijk vergeten bent</p>
+ <p>bedankt hè</p>
+ </div>
+ <?php include 'footer.php' ?>
+</body>
+</html>