-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
248 lines (236 loc) · 8.9 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
<?php
require_once './modules/conn.php';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="BookStore HTML5 Template" />
<title>Novel Nest - Find your favorite Novels</title>
<?php require_once './components/head.php' ?>
</head>
<body>
<!-- Preloader-->
<div id="preloader">
<div class="loader">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</div>
<!-- Back To Top Start -->
<a href="#main-wrapper" id="backto-top" class="back-to-top"><i class="fas fa-angle-up"></i></a>
<!-- Main Wrapper Start -->
<div id="main-wrapper" class="main-wrapper overflow-hidden">
<?php require_once './components/header.php' ?>
<!-- Hero-Banner Start -->
<div class="hero-banner-1 p-40">
<div class="container">
<div class="content">
<div class="row align-items-center">
<div class="col-xl-6 col-lg-6 col-12">
<div class="text-block mb-48 mb-lg-0">
<h1 class="mb-16">
Find Your <br />
Favorite Novels
</h1>
<p class="mb-64 dark-gray">
Novels are windows to worlds unseen, where imagination dances with words,
<br />
and every page is an invitation to explore the boundless realms of human experience.
</p>
<h6>
<a href="novel-listing.php" class="cus-btn"><span class="icon"><img src="assets/media/icons/btn-book.png" alt="" /></span>Explore</a>
</h6>
</div>
</div>
<div class="col-xl-2 offset-xl-0 col-md-3 offset-md-4 col-sm-3 offset-sm-3 col-3 offset-2 d-xl-block d-lg-none">
<div class="img-block-sm">
<img src="assets/media/images/image-2.png" alt="" />
</div>
</div>
<div class="col-xl-4 col-lg-4 col-md-5 offset-xl-0 offset-lg-2 col-sm-6 col-7">
<div class="img-block-lg">
<div class="discount-block">
<div class="block">
<h3 class="color-white">Novel</h3>
<h4 class="color-white">Nest</h4>
</div>
</div>
<img src="assets/media/images/hero-image.png" alt="" />
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Hero-Banner End -->
<!-- New Arrivals__2 Start -->
<section class="coming-soon p-40">
<div class="container">
<div class="button-bar mb-40">
<div class="heading mb-0">
<h3>New Arrivals</h3>
</div>
<h6>
<a href="novel-listing.php" class="cus-btn"><span class="icon"><img src="assets/media/icons/click-button.png" alt="" /></span>VIEW ALL</a>
</h6>
</div>
<div class="row g-2">
<?php
$query = "
SELECT
n.novel_id,
n.title,
n.publication_date,
n.banner,
n.description,
n.file,
a.name AS author_name,
a.biography AS author_biography,
g.name AS genre_name
FROM
novels n
JOIN
authors a ON n.author_id = a.author_id
JOIN
genres g ON n.genre_id = g.genre_id
WHERE
1 = 1
ORDER BY
n.publication_date DESC
LIMIT 3";
$result = $conn->query($query);
if ($result) {
while ($row = $result->fetch_assoc()) {
echo'<div class="col-xl-4 col-lg-4 col-md-6 col-sm-12">
<div class="coming-block">
<div class="fit-image">
<a href="novel-detail.php?id=' . $row['novel_id'] . '" style="width:100%;"><img src="' . $row['banner'] . '" class="br-20" alt="" style="width:100%; aspect-ratio:2/3; object-fit:cover;" /></a>
</div>
<div class="coming-content">
<div class="second-content">
<div class="title">
<h5 class="h5">' . $row['title'] . '</h5>
<span class="h6 medium-gray">' . $row['author_name'] . '</span>
</div>
<div class="product-btn">
<a href=""novel-detail.php?id='.$row['novel_id'].'""><i class="fal fa-eye"></i></a>
</div>
</div>
</div>
</div>
</div>';
}
} else {
echo 'Error executing the query: ' . $conn->error;
}
?>
</div>
</div>
</section>
<!-- New Arrivals__2 End -->
<!-- Inner banner Start -->
<section class="inner-banner-1 mt-40">
<div class="container">
<div class="row align-items-center">
<div class="col-xl-6 col-lg-4 col-md-12 col-sm-12 col-12 mb-24">
<div class="text-area">
<h5 class="color-primary mb-8">Genre</h5>
<span class="color-white h1 mb-8">Mystery</span>
<h6>
<a href="novel-listing.php" class="cus-btn"><span class="icon"><img src="assets/media/icons/click-button.png" alt="" /></span>View More</a>
</h6>
</div>
</div>
<div class="col-xl-6 col-lg-8 col-sm-12 col-12">
<div class="row">
<?php
$query = "
SELECT novel_id, banner, title
FROM novels
WHERE genre_id = (SELECT genre_id FROM genres WHERE name = 'Mystery')
LIMIT 3;
";
$result = $conn->query($query);
// Check if the query was successful
if ($result) {
while ($row = $result->fetch_assoc()) {
echo '
<div class="col-lg-4 col-md-4 col-sm-4 col-4">
<a class="inner-card p-1 text-decoration-none" href="./novel-detail.php?id=' . $row['novel_id'] . '" style="width:100%;">
<img style="width:100%; object-fit:cover; aspect-ratio:2/3;" class="rounded" src="' . $row['banner'] . '" alt="" class="mb-16" />
<h5 class="color-white mb-8">' . $row['title'] . '</h5>
</a>
</div>';
}
} else {
// Handle the case where the query fails
echo 'Error executing the query: ' . $conn->error;
}
?>
</div>
</div>
</div>
</div>
</section>
<!-- Inner banner End -->
<!-- Inner Banner-2 Start -->
<section class="inner-banner-2 mb-40">
<div class="container">
<div class="row align-items-center">
<div class="col-xl-6 col-lg-4 col-md-12 col-sm-12 col-12 mb-24">
<div class="text-area">
<h5 class="color-primary mb-8">Genre</h5>
<span class="color-white h1 mb-8">Horror</span>
<h6>
<a href="novel-listing.php" class="cus-btn"><span class="icon"><img src="assets/media/icons/click-button.png" alt="" /></span>View More</a>
</h6>
</div>
</div>
<div class="col-xl-6 col-lg-8 col-sm-12 col-12">
<div class="row">
<?php
$query = "
SELECT novel_id, banner, title
FROM novels
WHERE genre_id = (SELECT genre_id FROM genres WHERE name = 'Horror')
LIMIT 3;
";
$result = $conn->query($query);
// Check if the query was successful
if ($result) {
while ($row = $result->fetch_assoc()) {
echo '
<div class="col-lg-4 col-md-4 col-sm-4 col-4">
<a class="inner-card p-1 text-decoration-none" href="./novel-detail.php?id=' . $row['novel_id'] . '" style="width:100%;">
<img style="width:100%; object-fit:cover; aspect-ratio:2/3;" class="rounded" src="' . $row['banner'] . '" alt="" class="mb-16" />
<h5 class="color-white mb-8">' . $row['title'] . '</h5>
</a>
</div>';
}
} else {
// Handle the case where the query fails
echo 'Error executing the query: ' . $conn->error;
}
?>
</div>
</div>
</div>
</div>
</section>
<!-- Inner Banner-2 End -->
<!-- Footer Start -->
<?php require './components/footer.php' ?>
<!-- Footer Area End -->
</div>
<?php require './components/script.php' ?>
<?php require './modules/errorAlert.php';
require_once './modules/adminActivity.php';
require_once './modules/userActivity.php'; ?>
</body>
</html>