-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsinglePost.php
More file actions
83 lines (75 loc) · 3.47 KB
/
singlePost.php
File metadata and controls
83 lines (75 loc) · 3.47 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
<!doctype html>
<html lang="en">
<head>
<?php include("php/head.php"); ?>
<title>Single Post</title>
</head>
<body>
<?php include("php/header.php"); ?>
<?php include_once("php/dbconnection.function.php"); ?>
<?php
if(isset($_GET['id'])){
$id = $_GET['id'];
$row = dbconnection("spSelectPosts(NULL, '$id')");
$user = $row[0]['UID'];
$row2 = dbconnection("spSelectUser('$user')");
?>
<main class="container-fluid mt-4">
<div class="row">
<div class="col-12 order-last col-md-3 order-md-first">
<?php include("php/home/sidebar.inc.php") ?>
</div>
<div class="col-12 col-md-9">
<h1><?php echo $row[0]['Title']; ?></h1>
<div class="row">
<div class="col-12 col-xl-9">
<p><?php echo $row[0]['Message']; ?></p>
</div>
<div class="col-12 col-xl-3">
<div class="row">
<div class="col-12">
<button onclick=" addtofavpost(<?php echo $_GET['id']; ?>) " class="btn btn-lg btn-primary mb-4"><i class="fas fa-heart"></i> Add to Favorites List</button>
</div>
</div>
<div class="row">
<div class="col-12">
<ul class="list-group">
<h2 class="list-group-item bg-primary text-white">Post Details</h2>
<li class="list-group-item"><strong>Date:</strong> <?php echo $row[0]['PostTime']; ?></li>
<li class="list-group-item"><strong>Posted By:</strong> <?php echo $row2[0]['FirstName'];?> <?php echo $row2[0]['LastName'];?></li>
</ul>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<h2>Travel Images</h2>
</div>
</div>
<div class="row">
<?php
$row3 = dbconnection("spSelectImages('$user')");
foreach($row3 as $image){
?>
<div class="col-6 col-sm-4 col-md-3 col-xl-2 mb-4">
<div class="text-center">
<img src="travel-images/square-medium/<?php echo $image['Path']; ?>" class="img-thumbnail p-2" alt="database down">
<p><?php echo $image['Title']; ?></p>
<a href="singleImage.php?id=<?php echo $image['ImageID']; ?>" class="btn btn-primary">View</a>
<button onclick=" addtofav(<?php echo $image['ImageID']; ?>) " class="btn btn-primary">Favorites</button>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
<?php }
else {
echo '<div class="col-sm-12"><h1>No Post has been selected</h1></div>';
}
?>
</main>
<?php include("php/footer.php"); ?>
</body>
</html>