-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpost.php
More file actions
128 lines (97 loc) · 3.67 KB
/
Copy pathpost.php
File metadata and controls
128 lines (97 loc) · 3.67 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
<?php
ob_start();
?>
<!DOCTYPE html>
<html lang="en">
<?php
$title = "Individual Post";
$page = "posts";
session_start();
include_once("includes/header.php");
include_once("includes/db.php");
include_once("main/admin/functions.php");
?>
<body>
<!-- Navigation -->
<?php
include_once("includes/navigation.php");
?>
<!-- Page Content -->
<div class="container-fluid">
<div class="row">
<!-- Blog Post Content Column -->
<div class="col-lg-8 col-md-6 offset-md-3 offset-lg-0">
<!-- Blog Post -->
<?php
if(isset($_GET['p_id'] ) ) {
$post_id = $_GET['p_id'];
$query = "SELECT * FROM posts, users WHERE posts.post_author = users.user_id AND posts.post_id = $post_id";
$select_all_posts_query = mysqli_query($connection, $query);
if($row = mysqli_fetch_assoc($select_all_posts_query)) {
$post_title = $row['post_title'];
$post_author = $row['user_firstname'] . " " . $row['user_lastname'];
$post_date = $row['post_date'];
$post_image = $row['post_image'];
$post_content = $row['post_content'];
$post_author_id = $row['post_author'];
?>
<div class="post-item">
<!-- Title -->
<div class="post-title">
<h1><?php echo $post_title?></h1>
<?php
if( isset( $_SESSION['user_id'] ) ){
$user_id = $_SESSION['user_id'];
if($user_id == $post_author_id){
?>
<a href="Main/admin/posts.php?source=edit_post&p_id=<?php echo $post_id; ?>" class="fa fa-pencil btn btn-outline-warning">Edit Post</a>
<?php
}
}
?>
</div>
<!-- Author -->
<p>
by <a href="#"><?php echo $post_author?></a>
</p>
<hr>
<!-- Date/Time -->
<p><span class="glyphicon glyphicon-time"></span> Posted on <?php echo $post_date?></p>
<hr>
<!-- Preview Image -->
<img class="img-fluid" src="main/images/<?php echo $post_image?>" alt="<?php echo $post_title?>">
<hr>
<!-- Post Content -->
<p><?php echo $post_content?></p>
<hr>
<?php
}//end of result if
echo "</div>";
//COMMENTS BELONG HERE
include_once("comments.php");
}// end of if
else{
?>
<h2 style="">You are No Access To This Page</h2>
<?php
}
?>
</div>
<div class="col-lg-4 col-md-6 offset-md-3 offset-lg-0">
<?php
include_once("includes/sidebar.php");
?>
</div>
</div>
<!-- /.row -->
<hr>
<!--footer-->
<?php
include_once("includes/footer.php");
?>
</div>
<!-- /.container -->
<!-- jQuery -->
<?php include_once("includes/footer.php"); ?>
</body>
</html>