-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfirm.php
More file actions
21 lines (18 loc) · 765 Bytes
/
confirm.php
File metadata and controls
21 lines (18 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
session_start();
if(isset($_SESSION['id'])){}
else{
echo '<script>window.location.href="/"</script>';
}
$conn = pg_Connect("user=postgres password=rhkgkr6 dbname=mpharam");
$query = "select order_id from usertoorder where user_id = ".$_SESSION['id']." and status='current'";
$result = pg_query($conn, $query);
$row = pg_fetch_row($result);
$order_id = $row[0];
$query = "update orders set status='ordered', total=".$_GET['total']." where id = ".$order_id.";";
$result = pg_query($conn, $query);
$query = "update usertoorder set status='ordered' where user_id = ".$_SESSION['id']." and order_id = ".$order_id.";";
$result = pg_query($conn, $query);
echo '<script>alert("Successfully ordered")</script>';
echo '<script>window.location.href="/"</script>';
?>