-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibrary.html
More file actions
208 lines (174 loc) · 4.86 KB
/
Copy pathlibrary.html
File metadata and controls
208 lines (174 loc) · 4.86 KB
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
<!-- horizaxontal library code -->
<?php
session_start();
include '../../db/dbconnect.php';
// ✅ Check if session contains user_id or if there is a cookie containing the ID
if (!isset($_SESSION['user_id']) && isset($_COOKIE['user_id'])) {
$_SESSION['user_id'] = $_COOKIE['user_id'];
}
$user_id = $_SESSION['user_id']; // ✅ Use the stored session variable
$query = "SELECT Novels.novel_id, Novels.title, Novels.author_name, Novels.genre, Library.read_status
FROM Novels
JOIN Library ON Novels.novel_id = Library.novel_id
WHERE Library.user_id = ?";
$stmt = $conn->prepare($query);
$stmt->bind_param("i", $user_id);
$stmt->execute();
$result = $stmt->get_result();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Library</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f1de;
color: #4b2e2e;
margin: 0;
padding: 20px;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
/************* Navigation Bar *************/
.nav {
position: fixed;
top: 0;
left: 0;
width: 100%;
background-color: #a0522d;
color: white;
display: flex;
justify-content: space-around;
align-items: center;
padding: 10px 0;
z-index: 1000;
}
.nav a {
color: white;
text-decoration: none;
font-weight: bold;
padding: 10px 15px;
border-radius: 5px;
}
.nav a:hover {
background-color: rgba(255, 255, 255, 0.2);
}
/* Library Content */
.content {
padding-top: 80px;
}
.bookshelf-container {
width: 60%;
border: 2px solid #8c6d45;
border-radius: 8px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
padding: 20px;
background-color: #fff8dc;
position: relative;
margin: 0 auto;
}
h1 {
text-align: center;
font-family: 'Georgia', serif;
color: #a0522d;
}
.bookshelf {
background: #8b4513;
padding: 20px;
border-radius: 10px;
box-shadow: inset 0px -5px 0px #5a3212;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: flex-start;
gap: 12px;
min-height: 300px; /* Increased */
max-width: 100%;
}
/* Bookshelf Row: Ensures 10 Books per Row */
.shelf-row {
display: flex;
justify-content: center;
align-items: flex-end;
gap: 12px;
flex-wrap: wrap;
width: 100%;
max-width: 1100px; /* Limits row width */
}
/* Book Style - Much Bigger */
.book {
background: linear-gradient(to right, #a0522d 10%, #8b4513 40%, #6e3b15 90%);
color: white;
text-align: center;
padding: 20px 0;
border-radius: 5px;
box-shadow: 5px 5px 8px rgba(0, 0, 0, 0.3);
width: 55px; /* Increased Width */
height: 250px; /* Increased Height */
writing-mode: vertical-rl;
text-orientation: mixed;
font-size: 20px; /* Larger Text */
font-weight: bold;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transform-origin: bottom;
transition: transform 0.2s, box-shadow 0.2s;
}
.book:hover {
transform: scale(1.1);
box-shadow: 7px 7px 12px rgba(0, 0, 0, 0.4);
}
/* Ensures Only 10 Books Per Row */
.shelf-row:nth-child(n+2) {
margin-top: 20px;
}
/* Responsive Design */
@media (max-width: 1200px) {
.shelf-row {
max-width: 900px;
}
}
@media (max-width: 768px) {
.book {
width: 45px;
height: 200px;
font-size: 16px;
}
}
</style>
</head>
<body>
<div class="nav">
<a href="index.html">Home</a>
<a href="about.html">About</a>
<a href="diary.html">Diary</a>
<a href="User.html">User</a>
</div>
<div class="content">
<div class="bookshelf-container">
<div class="bookshelf-title">Owned Books</div>
<div class="bookshelf">
<div class="shelf-row">
<?php while ($row = $result->fetch_assoc()) { ?>
<div class="book" onclick="viewBook('<?php echo htmlspecialchars($row['title']); ?>')"">
<?php echo htmlspecialchars($row['title']); ?>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
<script>
function viewBook(bookName) {
alert('You clicked on ' + bookName);
}
</script>
</body>
</html>