-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbook.php
More file actions
71 lines (64 loc) · 2.68 KB
/
book.php
File metadata and controls
71 lines (64 loc) · 2.68 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
<?php
include 'include/db.php';
include 'include/functies/functies.php';
include 'include/bookid.php';
if($_GET['book'] ?? false){
$stmt = $db->prepare('SELECT b.id, b.author, b.image, b.title, b.release_date, g.genre, b.description, b.asin, b.language FROM books b JOIN genres g on b.genre = g.id WHERE b.slug = :slug');
$stmt->bindParam(':slug',$_GET['book']);
$stmt->execute();
$book = $stmt->fetch(PDO::FETCH_ASSOC);
$json = true;
$stmt = $db->prepare('SELECT id, name FROM characters WHERE books_id = :id');
$stmt->bindParam(':id', $book['id']);
$stmt->execute();
$chars = $stmt->fetchAll(PDO::FETCH_ASSOC);
if(count($chars) > 0){
foreach($chars as $k => $v){
$a[] = $v['name'];
};
$book['character'] = $a;
}
}else{
$book = false;
$json = false;
}
?>
<!doctype html>
<html>
<head>
<?php require_once 'include/meta.php';?>
<?php if($json){ echo makeJsonld($db, [$book['id']]);}?>
</head>
<body>
<div class="container">
<?php require_once 'include/header.php';?>
<main>
<div class="content">
<h1 class="title"><?php echo $book['title']; ?></h1>
<div class="row">
<iframe type="text/html" width="504" height="825" frameborder="0" allowfullscreen style="max-width:100%" src="https://read.amazon.com/kp/card?asin=<?php echo $book['asin']; ?>&preview=inline&linkCode=kpe&ref_=cm_sw_r_kb_dp_-sYtEb2YBFR85&hideShare=true" ></iframe>
<table>
<?php
echo '<tr><td class="first">Author:</td><td class="second"> '.$book['author'].'</td></tr>';
echo '<tr><td class="first">Title:</td><td class="second"> '.$book['title'].'</td></tr>';
echo '<tr><td class="first">Release Date:</td><td class="second"> '.$book['release_date'].'</td></tr>';
echo '<tr><td class="first">Genre:</td><td class="second"> '.$book['genre'].'</td></tr>';
echo '<tr><td class="first">Description:</td><td class="second"> '.$book['description'].'</td></tr>';
if($book['character'] ?? false){
echo '<tr><td class="first">character:</td><td class="second"><ul>';
foreach($book['character'] as $v){
echo '<li>'.$v.'</li>';
}
echo '</ul></td></tr>';
}
echo '<tr><td class="first">Asin:</td><td class="second"> '.$book['asin'].'</td></tr>';
echo '<tr><td class="first">Language:</td><td class="second"> '.$book['language'].'</td></tr>';
?>
</table>
</div>
</div>
</main>
<?php require_once 'include/footer.php';?>
</div>
</body>
</html>