-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbook1.php
More file actions
116 lines (106 loc) · 4.81 KB
/
book1.php
File metadata and controls
116 lines (106 loc) · 4.81 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
<?php
include("layout/include/header.php");
$id = $_GET['id'] ?? null;
$bookCat = $_GET['category'] ?? null;
if (!$id) {
echo '<div class="container mt-5"><div class="alert alert-warning">الكتاب غير موجود.</div></div>';
include("layout/include/footer.php");
exit;
}
// جلب بيانات الكتاب
$query = "SELECT * FROM books WHERE id = ?";
$stmt = mysqli_prepare($con, $query);
mysqli_stmt_bind_param($stmt, "i", $id);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
$row = mysqli_fetch_assoc($result);
if (!$row) {
echo '<div class="container mt-5"><div class="alert alert-danger">الكتاب غير موجود.</div></div>';
include("layout/include/footer.php");
exit;
}
?>
<!-- عرض الكتاب -->
<!-- عرض الكتاب -->
<div class="books mt-5 mb-5">
<div class="container">
<div class="row g-4 align-items-center">
<div class="col-md-4 text-center">
<div class="book-cover shadow-sm rounded overflow-hidden">
<img src="uploads/bookCovers/<?php echo htmlspecialchars($row['bookCover']); ?>" alt="<?php echo htmlspecialchars($row['bookTitle']); ?>" class="img-fluid rounded">
</div>
</div>
<div class="col-md-8">
<div class="book-content">
<h5 class="mb-2"><strong>اسم الكتاب:</strong> <?php echo htmlspecialchars($row['bookTitle']); ?></h5>
<h5 class="mb-3"><strong>اسم الكاتب:</strong>
<a href="author.php?author=<?php echo urlencode($row['bookAuthor']); ?>&category=<?php echo urlencode($row['bookCat']); ?>" class="text-success text-decoration-none">
<?php echo htmlspecialchars($row['bookAuthor']); ?>
</a>
</h5>
<hr>
<p class="text-secondary mb-4" style="line-height: 1.6;"><?php echo nl2br(htmlspecialchars($row['bookContent'])); ?></p>
<a href="uploads/books/<?php echo htmlspecialchars($row['book']); ?>" download class="btn btn-success btn-lg rounded-pill shadow">
<i class="bi bi-download me-2"></i> تحميل الكتاب
</a>
</div>
</div>
</div>
</div>
</div>
<!-- كتب ذات صلة -->
<div class="related-books bg-light py-5">
<div class="container">
<h3 class="mb-4 fw-bold text-success">كتب ذات صلة</h3>
<div class="row g-4">
<?php
if ($bookCat) {
$queryRelated = "SELECT * FROM books WHERE bookCat = ? AND id != ? LIMIT 8";
$stmtRelated = mysqli_prepare($con, $queryRelated);
mysqli_stmt_bind_param($stmtRelated, "si", $bookCat, $id);
mysqli_stmt_execute($stmtRelated);
$resRelated = mysqli_stmt_get_result($stmtRelated);
if (mysqli_num_rows($resRelated) == 0) {
echo '<p class="text-muted">لا توجد كتب ذات صلة.</p>';
} else {
while ($rel = mysqli_fetch_assoc($resRelated)) {
?>
<div class="col-lg-3 col-md-4 col-sm-6">
<div class="card h-100 shadow-sm border-0">
<a href="book1.php?id=<?php echo $rel['id']; ?>&category=<?php echo urlencode($rel['bookCat']); ?>">
<img src="uploads/bookCovers/<?php echo htmlspecialchars($rel['bookCover']); ?>" class="card-img-top" alt="<?php echo htmlspecialchars($rel['bookTitle']); ?>" style="height: 350px; object-fit: cover; border-radius: 0.5rem 0.5rem 0 0;">
</a>
<div class="card-body p-3">
<h5 class="card-title">
<a href="book1.php?id=<?php echo $rel['id']; ?>&category=<?php echo urlencode($rel['bookCat']); ?>" class="text-success text-decoration-none">
<?php echo htmlspecialchars($rel['bookTitle']); ?>
</a>
</h5>
</div>
</div>
</div>
<?php
}
}
}
?>
</div>
</div>
</div>
<?php
include("layout/include/footer.php");
?>
<!-- تحسينات CSS بسيطة -->
<style>
.book-cover img {
transition: transform 0.3s ease;
}
.book-cover:hover img {
transform: scale(1.05);
}
.related-books .card:hover {
transform: translateY(-5px);
box-shadow: 0 8px 15px rgb(0 0 0 / 0.15);
transition: all 0.3s ease;
}
</style>