-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfirmation.php
68 lines (61 loc) · 2.05 KB
/
confirmation.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!-- Form Update & Check Session -->
<?php
session_start();
unset($_SESSION["stok_kurang"]);
include "./database/dbpembayaran.php";
include "./database/dbProduct.php";?>
<!DOCTYPE html>
<html>
<head>
<title>Confirmation</title>
</head>
<body>
<?php
if($_SESSION["username"]!='admin')
{
header("Location:login.php");
}
?>
<?php
$query = "SELECT * FROM pembayaran";
$result = $con->query($query);
//list semua permintaan konfirmasi
if($result->num_rows > 0){
while ($row = $result->fetch_assoc() ){
if ($row["stat"]!="DECLINED"){
?>
<p>Username : <b> <?=$row["username"]; ?> </b></p>
<?php
$produk=$row["nama_produk"];
$jml=$row["jumlah"];
$id=$row["id"];
?>
<p>Total Pembayaran : Rp <?= $row["totalharga"]; ?></p>
<p>Nama Produk : <?= $row["nama_produk"]; ?></p>
<p>Jumlah Pemesanan : <?= $row["jumlah"]; ?></p>
<?php $que="SELECT * FROM product WHERE nama= ? ";
$statement = $connection->prepare($que);
$statement->bind_param("s",$produk);
$statement->execute();
$res = $statement->get_result();
$statement->close();
if($res)
{
$row1=$res->fetch_assoc();
if($jml>$row1["stock"])
{
$_SESSION["stok_kurang"]="Stock tidak mencukupi";
echo $_SESSION["stok_kurang"];
}
}?>
<img src="./bukti transfer/<?= $row["username"]?>/<?=$row["bukti_trf"]; ?>" class="img-responsive" alt="Image"> <!-- {image} = image from database -->
<br>
<?php if(!isset($_SESSION["stok_kurang"])){?>
<a class="btn btn-danger" href="./controller/doConfirmation.php?id=<?=$id?>">Confirm</a>
<?php }?>
<a class="btn btn-danger" href="./controller/doDecline.php?id=<?=$id?>">Decline</a>
<?php }}}?>
<br>
<a class="btn btn-danger" href="./home.php">Back</a>
</body>
</html>