forked from Ethredah/PHP-Blog-Admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
single.php
183 lines (148 loc) · 5.24 KB
/
single.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
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
<!--
author: Ethredah
author URL: http://ethredah.github.io
-->
<?php
require_once "Company_admin/functions/db.php";
if (isset($_GET['id'])) {
$postid = $_GET['id'];
$sql = "SELECT * FROM posts WHERE id='$postid'";
$query = mysqli_query($connection, $sql);
$sql2 = "SELECT * FROM comments WHERE blogid=$postid";
$query2 = mysqli_query($connection, $sql2);
}
else {
header('Location:blog.php');
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="icon" href="images/icon.png">
<title>Company</title>
<!-- custom-theme -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="Coalition Responsive web template, Bootstrap Web Templates, Flat Web Templates, Android Compatible web template,
Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyEricsson, Motorola web design" />
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false);
function hideURLbar(){ window.scrollTo(0,1); } </script>
<!-- //custom-theme -->
<link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="all" />
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
<!-- js -->
<script type="text/javascript" src="js/jquery-2.1.4.min.js"></script>
<!-- //js -->
<!-- font-awesome-icons -->
<link href="css/font-awesome.css" rel="stylesheet">
<!-- //font-awesome-icons -->
<link href="//fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
<link href='//fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700,700italic,800,800italic' rel='stylesheet' type='text/css'>
</head>
<body>
<!-- banner -->
<div class="banner1">
<div class="container">
<div class="w3_agile_banner_top">
<div class="agile_phone_mail">
<ul>
<li><i class="fa fa-phone" aria-hidden="true"></i>+(254) 002 100 500</li>
<li><i class="fa fa-envelope" aria-hidden="true"></i><a href="mailto:[email protected]">[email protected]</a></li>
</ul>
</div>
</div>
<div class="agileits_w3layouts_banner_nav">
<nav class="navbar navbar-default">
<div class="navbar-header navbar-left">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<h1><a class="navbar-brand" href="index.php"><img src="images/logo.png" class="img-responsive"></a></h1>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-right" id="bs-example-navbar-collapse-1">
<nav class="cl-effect-13" id="cl-effect-13">
<ul class="nav navbar-nav">
<li><a href="index.php">Home</a></li>
<li><a href="about.php">About</a></li>
<li><a href="portfolio.php">Products</a></li>
<li class="active"><a href="blog.php">Blog</a></li>
<li><a href="contact.php">Contact</a></li>
</ul>
</nav>
</div>
</nav>
</div>
</div>
</div>
<!-- //banner -->
<!-- gallery -->
<div class="gallery">
<div class="container">
<h2 class="w3l_head w3l_head1">Blog Post</h2>
<div class="wthree_gallery_grids">
<div class="row">
<?php
while ($row = mysqli_fetch_assoc($query)) {
echo
'<div class="col-md-12">
<a href="blog.php"><i class="fa fa-arrow-left"> Back</i></a>
<br>
<h4>'.$row["title"].'</h4>
<br>
<h6 style="color: orange;">'.$row["author"].' <b style="color: #000;">|</b> ('.mysqli_num_rows($query2).') Comments <b style="color: #000;">|</b> '.$row["date"].'</h6>
<br>
<p>
'.$row["content"].'
</p>'
;
}
?>
<hr>
<h4>Comments (<?php echo mysqli_num_rows($query2); ?>)</h4>
<br/>
<div style="border-style: double; border-color: #000;">
<div style="padding: 10px;">
<?php
while ($row2 = mysqli_fetch_assoc($query2)) {
echo
'
<b>'.$row2["name"].' :</b>
<p>
'.$row2["comment"].'
<i style="color: orange; float: right;">'.$row2["date"].'</i>
</p>
<hr>
';
}
?>
</div>
</div>
<hr>
<h3>Leave a comment</h3>
<br/>
<div class="agileits_mail_grid_left col-md-9" >
<form action="functions/comment.php" method="post">
<input type="hidden" name="blogid" value="<?php echo $postid;?>" />
<input type="text" name="name" placeholder="Name..." required />
<textarea placeholder="Comment..." name="comment" required></textarea>
<input type="submit" value="Submit Comment" name="submit">
</form>
</div>
</div>
</div>
<div class="row">
<!-- <h5>Comments</h5> -->
</div>
</div>
<script src="js/jzBox.js"></script>
</div>
</div>
<!-- //gallery -->
<!-- footer -->
<?php
include("footer.php");
?>