-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
65 lines (51 loc) · 2.05 KB
/
index.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
<?php
$site_title = "Banque des Développeurs";
require "template/nav.php";
include "template/header.php";
require_once "data/acounts.php";
require "database/session_start.php";
?>
<?php
try{
$db = new PDO('mysql:host=localhost;dbname=banque_php', 'BanquePHP', 'banque76');
} catch (PDOException $e){
print "Erreur !: " . $e->getMessage() . "<br/>";
die();
}
$userID= intval($_SESSION['user']["id"]);
$query = $db -> query(
"SELECT *
FROM User AS u
INNER JOIN Account AS a
ON u.id = a.user_id
WHERE u.id = $userID
"
);
$accounts = $query -> fetchAll(PDO::FETCH_ASSOC);?>
<h4 class="text-center mx-auto my-2 bg-warning text-dark" style="width: 38%;">Récapitulatif de vos comptes et livrets</h4>
<div class="row justify-content-around">
<?php
foreach ($accounts as $key => $value):
?>
<!-- Cards -->
<article class="card text-dark bg-warning font-weight-bold my-4 px-0 col-4" style="max-width: 18rem;">
<div class="card-header card-title text-center"><p><?php echo $value["account_type"]?></p></div>
<div class="card-header text-center"><p>Propriétaire : <?php echo $value["lastname"] . " " . $value["firstname"]?></p></div>
<div class="card-header text-center"><p>Numéro de compte : <?php echo $value["id"]?></p></div>
<div class="card-body bg-white text-center p-1">
<!-- <p class="card-text text-dark">Dernière opération : <br> <?php echo $value['last_operation'] ?>*</p> -->
<h5 class="card-title text-danger font-weight-bold">Solde : <?php echo $value["amount"] ?> €*</h5>
<a href="single.php<?php echo "?id=" . $value['id']; ?>" class="btn btn-secondary text-white">Voir</a>
<a href="comptes.php<?php echo "?id=$key"; ?>" class="btn btn-secondary text-white">Retrait / Dépôt</a>
<a href="delete.php<?php echo "?id=$key"; ?>" class="btn btn-secondary text-white">Clôturer</a>
<p class="card-text text-center text-muted">* Sous réserves de vos dernières opérations bancaires.</p>
</div>
</article>
<?php
endforeach;
?>
</div>
<?php
$JS = "<script src='public/js/layer.js'></script>";
include "template/footer.php";
?>