-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaccount.php
91 lines (81 loc) · 3.12 KB
/
account.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
session_start();
require_once "storage/UserStorage.php";
require_once "storage/CardStorage.php";
require_once "auth.php";
$cardStorage = new CardStorage();
$userStorage = new UserStorage();
if (!$auth->is_authenticated()) {
header('Location: index.php');
exit();
}
$cards = $cardStorage->findAll();
$user = $userStorage->findById($auth->authenticated_user()["id"])
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>IKémon | Home</title>
<link rel="stylesheet" href="styles/main.css">
<link rel="stylesheet" href="styles/cards.css">
</head>
<body>
<header>
<h1><a href="index.php">IKémon</a> > Account</h1>
<h1><a href="logout.php">Logout</a>
</header>
<div id="content">
<h1><?= $user["username"] ?></h1>
<h1><?= $user["email"] ?></h1>
<h1><?= $user["credits"] ?></h1>
<div id="card-list">
<?php foreach ($cards as $id => $card) : ?>
<?php if ($card["owner"] == $user["username"]) : ?>
<div class="pokemon-card">
<div class="image clr-<?= $card["type"] ?>">
<img src=<?= $card["image"] ?> alt=<?= $card["name"] ?>>
</div>
<div class="details">
<h2>
<a href="details.php?id=<?= $id ?>">
<?= $card["name"] ?>
</a>
</h2>
<span class="card-type">
<span class="icon">🏷</span>
<?= $card["type"] ?>
</span>
<span class="attributes">
<span class="card-hp">
<span class="icon">❤</span>
<?= $card["hp"] ?>
</span>
<span class="card-attack">
<span class="icon">⚔</span>
<?= $card["attack"] ?>
</span>
<span class="card-defense">
<span class="icon">🛡</span>
<?= $card["defense"] ?>
</span>
</span>
</div>
<a href="sell.php?id=<?= $id ?>">
<div class="buy">
<span class="card-price">
<span class="icon">Sell for 💰</span>
<?= $card["price"] * 0.9 ?></span>
</div>
</a>
</div>
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>
<footer>
<p>IKémon | ELTE IK Webprogramozás</p>
</footer>
</body>
</html>