-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdashboard.php
74 lines (62 loc) · 1.78 KB
/
dashboard.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
<?php
session_start();
?>
<!doctype html>
<html>
<head>
<?php
include "common/head.php"
?>
<style>
.center {
display: flex;
flex-direction: column;
align-items: center;
height: 50vh;
}
.center a {
margin: 10px;
}
</style>
</head>
<body>
<?php
include "common/appbar.php";
include ($_SERVER['DOCUMENT_ROOT'] . "/common/constants.php");
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
//count user's items
$email = $_SESSION['email'];
$sql = "SELECT * FROM items WHERE email = '$email'";
$result = $conn->query($sql);
$count = $result->num_rows;
?>
<div class="center" style="margin-top: 30vh;">
<div>
<div class="p-4">
<span class="text-lg">
<?php echo $_SESSION['email']; ?>
</span>
<i class="fas fa-check-circle text-green-500 mr-2"></i>
</div>
</div>
<div>
<a href="dashboard/create-element.php"
class="button bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">Создать товар</a>
<a href="dashboard/items.php"
class="button bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">Мои товары</a>
</div>
<div>
<div class="p-4">
<span class="text-lg">
Количество ваших товаров:
<?php echo $count ?>
</span>
</div>
</div>
</div>
</body>
</html>