-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShowPOST.php
More file actions
154 lines (108 loc) · 4.4 KB
/
ShowPOST.php
File metadata and controls
154 lines (108 loc) · 4.4 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
<?php include 'header.php' ; ?>
<div class="container">
<div class="row">
<div class="col-md-3" style="position : fixed;">
<table class="nav bs-sidenav table table-hover" id="sidebar-content">
<tr><td><a href="home.php">Home</a></td></tr>
<tr><td><a href="profile.php">Profile</a></td></tr>
<tr><td><a href="">Edit Profile</a></td></tr>
<tr><td><a href="">Friends</a></td></tr>
<tr><td><a href="Requests.php">Friend Requests</a></td></tr>
<tr><td><a href="">Messages</a></td></tr>
<tr><td><a href="">Photos of you</a></td></tr>
</table>
</div>
<div class="col-md-6 col-md-offset-3">
<ul>
<li>
<div>
<h5></h5>
<?php
include 'connection.php';
$POSTID=$_GET['varname'];
//echo $_SESSION['user_id'];
echo $POSTID;
$query = ("SELECT * from posts where user_id='".$_SESSION['user_id']."' and post_id='".$POSTID."'");
$result = mysqli_query($link , $query);
$results = mysqli_num_rows($result);
//echo $results."hhhhhhhhhhhhhhhhhhh";
if($results > 0){
$row=mysqli_fetch_array($result);
$query1 = ("SELECT user_fname,user_lname,p.picture_path from users
Inner Join pictures as p ON users.user_profile_picture=p.picture_id where user_id='".$_SESSION['user_id']."' ");
$result1 = mysqli_query($link , $query1);
$results1 = mysqli_num_rows($result1);
//echo $results."hhhhhhhhhhhhhhhhhhh11";
$row1=mysqli_fetch_array($result1);
//print_r($row1);
$fname=$row1['user_fname'];
$lname=$row1['user_lname'];
$Upic='images/'.$row1['picture_path'];
$FULLNAME=ucfirst($fname)." ".ucfirst($lname);
//echo "<br/>".$FULLNAME."<br/>";
echo '
<li>
<div>
<img src="'.$Upic.'" class="profile">
<a href="profile.php" >'.$FULLNAME.' ('.$row['post_timestamp'].')</a><br/> <br/>
<span> '.$row['post_text'].' </span>
</div> ';
}
$query1 = ("SELECT u.user_fname,u.user_lname,p.picture_path from likes
Inner join users as u ON u.user_id=likes.user_id
Inner join pictures as p on u.user_profile_picture = p.picture_id
where post_id='".$POSTID."'
ORDER BY likes.like_timestamp");
$result1 = mysqli_query($link , $query1);
$results1 = mysqli_num_rows($result1);
$likers=" ";
$row12=mysqli_fetch_array($result1);
$lUpic='images/'.$row12['picture_path'];
$FULLNAME_liker=ucfirst($row12['user_fname'])." ".ucfirst($row12['user_lname']);
$likers=$FULLNAME_liker;
while($row1=mysqli_fetch_array($result1))
{
$FULLNAME_liker=ucfirst($row1['user_fname'])." ".ucfirst($row1['user_lname']);
$likers=$likers.",".$FULLNAME_liker;
}
//echo $likers;
echo '
<li>
<div>
<img src="'.$lUpic.'" class="profile">
<span> '.$likers.' liked your post </span>
</div> ';
$query1 = ("SELECT u.user_fname,u.user_lname,p.picture_path,c.comment_text from comments as c
INNER JOIN users as u ON u.user_id = c.user_id
INNER JOIN pictures as p On p.picture_id=u.user_profile_picture
where c.post_id= '".$POSTID."'
ORDER BY c.comment_timestamp ASC");
$result1 = mysqli_query($link , $query1);
$results1 = mysqli_num_rows($result1);
if($results1>0)
{
while($row1=mysqli_fetch_array($result1))
{
$fname=$row1['user_fname'];
$lname=$row1['user_lname'];
$UFULLN=$fname." ".$lname;
$comment=$row1['comment_text'];
$upic='images/'.$row1['picture_path'];
echo '
<li>
<div>
<img src="'.$Upic.'" class="profile">
<a href="profile.php" >'.$UFULLN.'</a><br/> <br/>
<span> '.$comment.' </span>
</div> ';
}
}
?>
</div>
</li>
</ul>
</div>
</div>
</div>
</body>
</html>