-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdetails.php
More file actions
266 lines (209 loc) · 9.26 KB
/
Copy pathdetails.php
File metadata and controls
266 lines (209 loc) · 9.26 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>The Travel Blog</title>
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- bjqs.css contains the *essential* css needed for the slider to work -->
<link rel="stylesheet" href="css/bjqs.css">
<!-- demo.css contains additional styles used to set up this demo page - not required for the slider -->
<link rel="stylesheet" href="css/demo.css">
<!-- load jQuery and the plugin -->
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="js/bjqs-1.3.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- Navigation -->
<?php include('outer_header.php');?>
<!-- Full Width Image Header with Logo -->
<!-- Image backgrounds are set within the full-width-pics.css file. -->
<!-- <header class="image-bg-fluid-height">
<img class="img-responsive img-center" src="images/grand-canyon-1083745_1920.jpg" alt="">
</header>-->
<!-- Content Section -->
<section>
<div class="container">
<div class="row">
<div class="col-lg-12">
<h1 class="section-heading">Adventure details</h1>
<p class="lead section-lead">Below are all details of the adventure.</p>
</div>
</div>
<?php
$sql = "SELECT
adventure.title,
adventure.tags,
adventure.description,
adventure.date,
adventure.`status`,
adventure.country,
country.`name` AS country_name,
adventure.id,
adventure.by_id,
(SELECT COUNT(*) FROM likes WHERE adventure_id = adventure.id ) AS likes,
(SELECT COUNT(*) FROM comments WHERE adventure_id = adventure.id ) AS comments
FROM
adventure
INNER JOIN country ON adventure.country = country.id
WHERE
adventure.id = ".$_GET{'id'}." AND
adventure.`status` = 1 ";
$query = mysqli_query($con,$sql);
$row = mysqli_fetch_array($query);
?>
<div class="row">
<div class="col-lg-12">
<p style="vertical-align:top"class="lead section-lead"><?php echo $row['title'];?></p>
<p style="vertical-align:top" ><?php echo $row['description'];?></p>
<p style="vertical-align:top" >Posted On: <?php echo $row['date'];?></p>
<p style="vertical-align:top" >Adventure Country: <?php echo $row['country_name'];?></p>
</div>
<?php
$sql2= 'SELECT * FROM uploads WHERE adventure_id = '.$_GET['id'] ;
$query2 = mysqli_query($con,$sql2);
if(mysqli_num_rows($query2) > 0 ){
?>
<div class="col-lg-12">
<div id="banner-slide">
<ul class="bjqs">
<?php
while( $row2 = mysqli_fetch_array($query2)){
?>
<li>
<img src="uploads/<?php echo $row2['name'];?>">
</li>
<?php }?>
</ul>
</div>
<?php }?>
</div>
</div>
<div class="row">
<div class="col-lg-12" >
<div class="alert alert-info">
<strong>Adventure Tags: </strong> <?php echo $row['tags']?>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12" ><div class="alert alert-warning">
<strong><?php echo $row['likes']; ?></strong> People voted,<strong><?php echo $row['comments']?></strong> comments.
</div></div>
</div>
<div class="row">
<div class="col-lg-12" style="height:10px;" ></div></div>
<?php if(isset($_SESSION['user'])){?>
<?php if( $row['by_id'] != $_SESSION['user']['id'] ){?>
<div class="row"> <div class="col-lg-12" ><a href="./like_form.php?id=<?php echo $_GET['id'] ?>">Vote</a> this adventure.</div></div>
<?php }
}else{?>
<div class="row"> <div class="col-lg-12" >Sign in to Vote or comment on this adventure.</div></div>
<?php }?>
<div class="row">
<div class="col-lg-12" >
<section class="panel">
<header class="panel-heading">
<strong>Recent Comments</strong>
</header>
<div class="panel-body table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Date</th>
<th>Comments</th>
</tr>
</thead>
<tbody>
<?php $sql3= 'SELECT
comments.comments,
comments.id AS comments_id,
comments.commented_by,
`user`.`name`,
comments.date
FROM
comments
INNER JOIN `user` ON comments.commented_by = `user`.id
WHERE adventure_id = '.$_GET['id'].' ORDER BY
comments.id DESC' ;
$query3 = mysqli_query($con,$sql3);
?>
<?php while($row3 = mysqli_fetch_array($query3)){ ?>
<tr>
<td><?php echo $row3['date'] ?></td>
<td><strong><?php echo $row3['name']?></strong> said:<br><?php echo $row3['comments']?>
<?php
if(isset($_SESSION['user']) and ($row3['commented_by']==$_SESSION['user']['id'] or $row['by_id'] == $_SESSION['user']['id'])){
?>
<br><a href="./delete_comments_form.php?id=<?php echo $row3['comments_id'];?>&adventure_id=<?php echo $row['id']?>">Delete Comments</a>
<?php }?>
<?php if(isset($_SESSION['user']) and $row3['commented_by']==$_SESSION['user']['id']){
?>
- <a href="./edit_comments.php?id=<?php echo $row3['comments_id'];?>&adventure_id=<?php echo $row['id']?>">Edit comments</a>
<?php }?>
</td>
</tr>
<?php }?>
</tbody>
</table>
</div>
</section>
</div>
</div>
<?php if(isset($_SESSION['user'])){?>
<div class="row">
<div class="col-lg-12 col-xs-offset-1" >
<form role="form" action="comments_form.php" method="post">
<input type="hidden" name="id" value="<?php echo $_GET['id'];?>" />
<div class="form-group">
<label for="InputComments">Comments</label>
<div class="input-group">
<textarea class="form-control" name="InputComments" id="InputComments" placeholder="Type Comments" required width="100%"></textarea>
<span class="input-group-addon"><span class="glyphicon glyphicon-asterisk"></span></span>
</div>
</div>
<input type="submit" name="submit" id="submit" value="Post Comments" class="btn btn-secondery pull-right">
</form>
</div>
</div>
<?php }?>
</div>
</section>
<?php include('footer.php');?>
<script>
jQuery(document).ready(function($) {
$('#banner-slide').bjqs({
animtype : 'slide',
width : 1000,
height : 1000,
responsive : true,
randomstart : true,
animspeed : 3000
});
});
</script>
<script src="js/libs/jquery.secret-source.min.js"></script>
<script>
jQuery(function($) {
$('.secret-source').secretSource({
includeTag: false
});
});
</script>
</body>
<!-- jQuery -->
<!-- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>-->
</html>