-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfullpost.php
178 lines (152 loc) · 4.79 KB
/
fullpost.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
<?php
extract($_POST);
if(isset($save))
{
$name=$uname;
$email=$umail;
$comment=mysqli_real_escape_string($conn,$_POST["comment"]);
date_default_timezone_set('Asia/Kolkata');
$datetime = date('m/d/Y h:i:s a', time());
//$datetime;
$postid=$_GET["post_id"];
if(empty($name) || empty($email) || empty($comment))
{
$err.= "
<div class='alert alert-warning'>
<a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a>
<b>All field are required</b>
</div>
";
//Redirect_to("Fullpost.php?id={$postid}");
}
elseif(strlen($comment)>500){
$err.= "
<div class='alert alert-warning'>
<a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a>
<b>only Max 500 characters allowed!</b>
</div>
";
//Redirect_to("Fullpost.php?id={$postid}");
}
else if($err == null){
$postidfromurl=$_GET["post_id"];
$execute=mysqli_query($conn,"insert into comments(datetime,name,email,comment,approvedBy,status,adminpanel_id)values('$datetime','$name','$email','$comment','pending','OFF','$postidfromurl')");
if($execute){
$err.= "
<div class='alert alert-success'>
<a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a>
<b>Comment Added successfully</b>
</div>
";
//Redirect_to("Fullpost.php?id={$postid}");
}else{
$err.= "
<div class='alert alert-warning'>
<a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a>
<b>OOPS! something went wrong</b>
</div>
";
//Redirect_to("Fullpost.php?id={$postid}");
}
}
}
?>
<div id="fetch_fullpost">
<div class="col-md-2"></div>
<div class="col-md-8">
<div class="blog-header"><h1>Full Post </h1></div>
<div class="col-md-12" id="login_msg">
<?php echo($err) ?>
</div>
<?php
$postidfromurl=$_GET["post_id"];
$Viewquery="select * from adminpanel where id='$postidfromurl' order by id desc";
//echo $postidfromurl;
$execute=mysqli_query($conn,$Viewquery);
while($datarows=mysqli_fetch_array($execute)){
$postid=$datarows["id"];
$datetime=$datarows["datetime"];
$title=$datarows["title"];
$category=$datarows["category"];
$admin=$datarows["author"];
$image=$datarows["image"];
$post=$datarows["post"];
$userAccess=$datarows["userAccess"];
?>
<div class = "blogpost img-thumbnail">
<?php
$imageFileType = strtolower(pathinfo($image,PATHINFO_EXTENSION));
if($imageFileType == "mp4")
{
echo"<video class='img-thumbnail img-responsive img-rounded' controls>
<source src='Upload/".$image."' type='video/webm'>
</video>";
}
else{
?>
<img class="img-thumbnail img-responsive img-rounded" src="Upload/<?php echo $image;?>" height="400px" width="400px" >
<?php } ?>
<div class="caption">
<h1 id="heading"> <?php echo htmlentities($title); ?></h1>
<p class="description">Category:<?php echo htmlentities($category) ?> published on:<?php echo htmlentities($datetime) ?></p>
<p class="post"><?php echo nl2br($post) ?></p>
</div>
</div>
<br>
<?php }?>
<br><br>
<span class="fieldinfo">Comments</span>
<?php
$postidforcomments=$_GET["post_id"];
$Extractingcommentsquery="select * from comments where adminpanel_id='$postidforcomments' and status='ON'";
$execute=mysqli_query($conn,$Extractingcommentsquery);
while($datarows=mysqli_fetch_array($execute)){
$commentdate=$datarows["datetime"];
$commentername=$datarows["name"];
$commentbyusers=$datarows["comment"];
?>
<div id="fetch_comments" class="commentblock">
<img style="margin-left:10px; margin-top:10px;" class="pull-left" src="images/comment.png" width=70px; height=70px;>
<p style="margin-left:90px;" class="commentinfo"><?php echo $commentername; ?></p>
<p style="margin-left:90px;" class="description"><?php echo $commentdate; ?></p>
<p style="margin-left:90px;" class="comment"><?php echo nl2br($commentbyusers); ?></p>
</div>
<hr>
<?php } ?>
<br><br>
<br><br>
<div class="row">
<div class="col-md-12">
<div class="panel panel-info">
<div class="panel-heading">Share Your Thought about the Post</div>
<div class="panel-body">
<form method="post">
<div class="row">
<div class="col-md-12">
<label for="postarea"><span class="fieldinfo">Comment:</span></label>
<textarea class="form-control" name="comment" id="commentarea"></textarea>
</div>
</div>
<p><br/></p>
<div class="row">
<div class="col-md-12">
<input name="save" type="submit" value="Post Comment" class="btn btn-lg btn-success btn-block">
</div>
</div>
<br><br>
<div class="col-md-12" id="login_msg">
<?php /*echo($err)*/ ?>
</div>
</div>
</form>
</div>
</div>
</div>
</div> <!--Main blog area ending-->
<div class="col-md-2"></div>
</div>
<script>
if ( window.history.replaceState ) {
window.history.replaceState( null, null, window.location.href );
}
</script>