-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpembayaran.php
73 lines (58 loc) · 1.76 KB
/
pembayaran.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
69
70
71
72
73
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<title>Pay</title>
</head>
<body>
<!-- If user has not logged in, Redirect to login.php -->
<?php
if (!isset($_SESSION["username"])){
header("Location: ./login.php");
}
?>
<!-- Show Error Message -->
<p style="color: red;">
<!-- [ERROR MESSAGE] -->
<?php
if (isset($_SESSION["error"])){
echo $_SESSION["error"];
}
?>
</p>
<a href="./home.php">Back to home</a>
<br><br>
<?php
$uname=$_SESSION["username"];
include "./database/dbPembelian.php";
$query = "SELECT * FROM pembelian WHERE username = ? ";
$statement = $conn->prepare($query);
$statement->bind_param("s",$uname);
$statement->execute();
$result = $statement->get_result();
$statement->close();
$totalharga=0;
//klo ketemu
if( $result->num_rows > 0){
while ($row = $result->fetch_assoc())
{
$totalharga=$totalharga+$row["harga"];}
$_SESSION['total']=$totalharga;
?>
<!-- BELOM VALIDASI!!!!!! -->
<form class="form-horizontal" method="POST" action="./controller/doPembayaran.php" enctype="multipart/form-data">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'];?>">
Harga yang harus dibayar :
<p>Rp <?php echo $totalharga; ?></p>
Upload bukti bayar:
<input type="file" id="gambar" name="gambar">
<br>
<button type="submit">Submit</button></button>
</div>
</form>
<?php }?>
</div>
</body>
</html>