-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
83 lines (72 loc) · 3 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
<?php include 'config.php'; ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Página inicial</title>
<link rel="stylesheet" href="css/general.css">
<link rel="stylesheet" href="css/index.css">
<link rel="stylesheet" href="css/slider.css">
<script src="js/general.js" defer></script>
<script src="js/slider.js" defer></script>
</head>
<body>
<?php include 'nav.php'; ?>
<section class="slider">
<div class="slider-container">
<div class="slide-frame fade">
<img src="rsrc/img/banner/banner1.png" style="width:100%">
</div>
<div class="slide-frame fade">
<img src="rsrc/img/banner/banner2.png" style="width:100%">
</div>
<a class="prev" onclick="prevSlide(this)">❮</a>
<a class="next" onclick="nextSlide(this)">❯</a>
</div>
</section>
<section class="featured-products">
<h3>Produtos em destaque</h3>
<div class="products">
<?php
$conn = new mysqli($GLOBALS['sql_host'], $GLOBALS['sql_user'], $GLOBALS['sql_pass'], $GLOBALS['sql_db']);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
/* PRODUTO */
$sql = "SELECT * FROM `produtos` WHERE `featured`='1';";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
?>
<div class="product" product-id="<?php echo $row['id']; ?>">
<div class="product-image"
style="background-image: url('<?php echo $row['img_dir']; ?>');">
</div>
<div class="product-info">
<div class="product-title">
<div class="product-name">
<p><?php echo $row['name']; ?></p>
</div>
<p class="product-price">R$ <?php echo str_replace(".", ",", strval($row["price"]))?></p>
</div>
<div class="product-description">
<p><?php echo $row['description']; ?></p>
</div>
</div>
</div>
<?php
}
} else {
$conn->close();
return;
}
$conn->close();
?>
</div>
</section>
<footer class="footer">
<span class="js-year">2023</span> © Todos os Direitos Reservados a Confeitaria | Imagens meramente ilustrativas.
</footer>
</body>
</html>