-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsingleBookListing.php
More file actions
79 lines (73 loc) · 3.13 KB
/
singleBookListing.php
File metadata and controls
79 lines (73 loc) · 3.13 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
<?php
require_once("resources/functions/dbconnection.function.php");
$bookID = "";
if (empty($_GET["id"]) || !is_numeric($_GET["id"])) {
die("Error: invalid book posting.");
}
$bookID = $_GET["id"];
$bookData = dbconnection("spSelectUserSellBook({$bookID}, NULL, NULL, NULL, NULL, NULL)");
if (count($bookData) != 1) {
die("Error: invalid book posting.");
}
$bookData = $bookData[0];
$photos = dbconnection("spSelectUserSellBookPhoto({$bookID})");
$sellerInfo = dbconnection("spSelectEmail(\"". $bookData["email"] ."\")")[0];
?>
<!doctype html>
<html lang="en">
<head>
<title>Book Listing</title>
<?php include("resources/includes/head.inc.php"); ?>
<link type="text/css" rel="stylesheet" href="resources/css/lightslider.css">
<script src="resources/js/lightslider.js"></script>
<script src="resources/js/copyEmail.js"></script>
</head>
<body>
<?php include("resources/includes/header.inc.php"); ?>
<main class="container my-4">
<div class="row">
<div class="col">
<h1 class="mt-2"><?php echo $bookData["title"];?></h1>
<h2 class="mt-2">Seller</h2>
<h4><?php echo $sellerInfo["name"];?></h4>
<h2 class="mt-2">ISBN</h2>
<h4><?php echo $bookData["bookISBN"];?></h4>
<h2 class="mt-2">Condition</h2>
<h4><?php echo $bookData["bookCondition"];?></h4>
<h2 class="mt-2">Price</h2>
<h4>$<?php
if (empty($bookData["price"])) {echo "0.00";}
else {echo $bookData["price"];}
?></h4>
<h2 class="mt-2">Listing Description</h2>
<h4><?php echo $bookData["longDescription"];?></h4><br>
<button id="copyButton" class="btn bg-orange mb-4" type="button" onclick="copyEmail('<?php echo $bookData['email']; ?>')">Contact Seller</button>
</div>
</div>
<div class="row">
<div class="col">
<h1>Pictures</h1>
<?php if (count($photos) > 0) {?>
<ul id="lightSlider">
<?php
foreach($photos as $photo) {
echo "<li>
<img src='resources/images/{$photo['photoName']}' alt='Picture'>
</li>";
}
?>
</ul>
<?php }else {?>
<h4>There are no pictures for this book</h4>
<?php }?>
</div>
</div>
</main>
<?php include("resources/includes/footer.inc.php"); ?>
</body>
</html>
<script type="text/javascript">
$(document).ready(function() {
$("#lightSlider").lightSlider();
});
</script>