-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinspect.php
67 lines (50 loc) · 2.08 KB
/
inspect.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
<?php
// for error logging incase of fail
error_reporting(E_ALL);
ini_set('display_errors', 1);
// loads the dynamic header
$page_name="inspect";
require_once('inc/header.php');
// loading database
require_once('inc/lib.php');
connect();
$id = $_GET['id'];
$sql = "SELECT * FROM images WHERE id = $id";
$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_assoc($result);
echo '<div class="container">';
echo '<div class="image-container">';
echo '<img id="artwork-image" src="images/artwork/' . $row["id"] . '.png" alt="artpiece name = ' . $row["title"] . '">';
echo '</div>';
echo '<div class="info-container">';
echo '<h1>' . $row["title"] . '</h1>';
//($page_name == 'gallery') ? 'id="current_page"' : 'id="other_page"';
echo '<pre>Year : ' . (($row["year"] === NULL) ? "Unkown" : $row["year"]) . '</pre>';
echo '<pre>Medium : ' . (($row["medium"] === NULL) ? "Unkown" : $row["medium"]) . '</pre>';
echo '<pre>Size : ' . (($row["size"] === NULL) ? "Unkown" : "W" . $row["width"] ."cm x H". $row["height"] . "cm") . '</pre>';
echo '<pre>Sold : ' . $row["sold"] .'</pre>';
echo '<pre>In Basket : ' . get_basket_count($row["id"]) .'</pre>';
//echo '<p>ID : ' . $row["id"] . '</p>';
if ($userkey == "" ) { // not logged in
echo '<button id="button_good" onclick="window.location.href=\'login.php\'">Login to Purchase</button>';
}else { // logged in
echo '<div class="button-container">';
echo '<form method="post" action="">';
echo '<input type="hidden" name="id" value="' . $row["id"] . '">';
echo '<button type="submit" name="add_to_cart" id="button_good">Bascket item</button>';
echo '</form>';
echo '<form method="post" action="">';
echo '<input type="hidden" name="id" value="' . $row["id"] . '">';
echo '<button type="submit" name="remove_from_cart" id="button_bad">Remove item</button>';
echo '</form>';
echo '</div>';
}
echo '</div>';
echo '</div>';
?>
<body>
<!-- main content of the page -->
<div id="back_gradient"></div>
<?php include 'inc/footer.php'; ?>
</body>
</html>