-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
166 lines (147 loc) · 6.73 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
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<?php
require_once __DIR__ . '/backend/php/global.php';
/** @var BDD $pdo */
$pdo = $_SESSION['pdo'];
$products = $pdo->getProducts();
if (isLoggedIn() && !empty($_COOKIE['id_client'])) {
$rows = $pdo->getCarts($_COOKIE['id_client'])->rowCount();
//$rows = 0;
} else if (isLoggedIn() && !empty($_SESSION['id_client'])) {
$rows = $pdo->getCarts($_SESSION['id_client'])->rowCount();
//$rows = 0;
} else {
$rows = 0;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="author" content="Baptiste Lacroix">
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" href="./css/accueil.css">
<link rel="stylesheet" href="./css/buttons.css">
<title>Painting Oil Beautify</title>
</head>
<body>
<header>
<div class="logo"><a href="./index.php">Oil Painting</a></div>
<div class="hamburger"><span></span></div>
<nav class="nav-bar">
<ul>
<li><a href="./index.php" class="active">Home</a></li>
<li><a href="./public/explore.php">
<svg class="icon-svg" xmlns="http://www.w3.org/2000/svg" width="1em" height="1em"
preserveAspectRatio="xMidYMid meet" viewBox="0 0 20 20">
<g fill="white">
<path fill-rule="evenodd"
d="M4.475 4.475a5.5 5.5 0 1 0 7.778 7.778a5.5 5.5 0 0 0-7.778-7.778Zm6.364 6.364a3.5 3.5 0 1 1-4.95-4.95a3.5 3.5 0 0 1 4.95 4.95Z"
clip-rule="evenodd"></path>
<path d="M11.192 13.314a1.5 1.5 0 1 1 2.122-2.122l3.535 3.536a1.5 1.5 0 1 1-2.121 2.121l-3.536-3.535Z"></path>
</g>
</svg>
</a></li>
<li><a href="#">About Us</a></li>
<li>
<a href="./public/cart.php">
<svg class="icon-svg" xmlns="http://www.w3.org/2000/svg" width="1em" height="1em"
preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24">
<path fill="white"
d="M7 22q-.825 0-1.412-.587Q5 20.825 5 20q0-.825.588-1.413Q6.175 18 7 18t1.412.587Q9 19.175 9 20q0 .825-.588 1.413Q7.825 22 7 22Zm10 0q-.825 0-1.412-.587Q15 20.825 15 20q0-.825.588-1.413Q16.175 18 17 18t1.413.587Q19 19.175 19 20q0 .825-.587 1.413Q17.825 22 17 22ZM5.2 4h14.75q.575 0 .875.512q.3.513.025 1.038l-3.55 6.4q-.275.5-.738.775Q16.1 13 15.55 13H8.1L7 15h12v2H7q-1.125 0-1.7-.988q-.575-.987-.05-1.962L6.6 11.6L3 4H1V2h3.25Z"></path>
</svg>
<span id="cart-quantity"><?= $rows ?></span>
</a>
</li>
<li>
<a href="./public/login.php">
<svg class="icon-svg" xmlns="http://www.w3.org/2000/svg" width="1em" height="1em"
preserveAspectRatio="xMidYMid meet" viewBox="0 0 16 16">
<g fill="white">
<path d="M11 6a3 3 0 1 1-6 0a3 3 0 0 1 6 0z"></path>
<path fill-rule="evenodd"
d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8zm8-7a7 7 0 0 0-5.468 11.37C3.242 11.226 4.805 10 8 10s4.757 1.225 5.468 2.37A7 7 0 0 0 8 1z"></path>
</g>
</svg>
</a>
</li>
<li>
<a href="./backend/php/logout.php" target="_parent">
<svg class="icon-svg" xmlns="http://www.w3.org/2000/svg" width="1em" height="1em"
preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24">
<path fill="white"
d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2a9.985 9.985 0 0 1 8 4h-2.71a8 8 0 1 0 .001 12h2.71A9.985 9.985 0 0 1 12 22zm7-6v-3h-8v-2h8V8l5 4l-5 4z"/>
</svg>
</a>
</li>
</ul>
</nav>
</header>
<script>
let linkNav = document.createElement('link');
linkNav.rel = 'stylesheet';
linkNav.type = 'text/css';
linkNav.href = './css/navbar.css';
document.head.appendChild(linkNav);
let hamburger = document.querySelector('.hamburger');
let nav = document.querySelector('.nav-bar');
hamburger.onclick = function () {
nav = document.querySelector('.nav-bar');
nav.classList.toggle('active');
hamburger.classList.toggle('active');
}
</script>
<div class="container">
<div class="horizontal-scroll">
<button class="btn-scroll" id="btn-scroll-left"></button>
<button class="btn-scroll" id="btn-scroll-right"></button>
<div class="images-containers">
<?php foreach ($products as $product) { ?>
<div class="image-size">
<img src="data:image/webp;base64,<?= base64_encode($product['image']) ?>"
alt="<?php echo $product['titre_produit'] ?>">
<a class="btn-information cta"
href="public/product.php?reference=<?php echo $product['reference_produit'] ?>">
<span class="hover-underline-animation">
Shop now
</span>
</a>
</div>
<?php } ?>
</div>
</div>
</div>
<script src="./backend/javascript/accueil.js"></script>
<script>
const footer = document.createElement('footer');
const body = document.querySelector('body');
function createFooter() {
let linkFooter = document.createElement('link');
linkFooter.rel = 'stylesheet';
linkFooter.type = 'text/css';
linkFooter.href = './css/footer.css';
document.head.appendChild(linkFooter);
let listOfInnerHTML = ['Home', 'Explore', 'About Us', 'Cart', 'Login'];
let listOfLinks = ['./index.php', './public/explore.php', '#', './public/cart.php', './public/login.php'];
footer.classList.add('sticky-footer');
let ul = document.createElement('ul');
for (let i = 0; i < listOfLinks.length; i++) {
let li = document.createElement('li');
let a = document.createElement('a');
a.href = listOfLinks[i];
a.innerHTML = listOfInnerHTML[i];
li.appendChild(a);
ul.appendChild(li);
}
footer.appendChild(ul);
let p = document.createElement('p');
let a = document.createElement('a');
a.href = 'mailto:baptiste.lacroix@etu.unice.fr';
a.innerHTML = '© Copyright - Lacroix Baptiste - 2022/2023 - All rights reserved';
p.appendChild(a);
footer.appendChild(p);
body.appendChild(footer);
}
createFooter();
</script>
</body>
</html>