-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfindfollowing.php
48 lines (47 loc) · 2.44 KB
/
findfollowing.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
<?php
if(!isset($_COOKIE['user']) || !isset($_COOKIE['email'])){
header('Location:index.php');
}else{
date_default_timezone_set('Africa/Lagos');
require 'db.php';
?>
<?php
$user=$_POST['followinguser'];
$current=$_POST['mainuser'];
if(empty($_POST['followinguser'])){
echo "";
}else{
$sql="SELECT * FROM followership INNER JOIN artiste_info ON followership.following=artiste_info.username
WHERE followership.following LIKE '%$user%' AND followership.follower='$current';";
$result=mysqli_query($conn,$sql);
if(mysqli_num_rows($result) > 0){
while ($row=mysqli_fetch_assoc($result)) {
$user=$_COOKIE['user'];
if($row['profile_pic']=='' && $row['username']==$user ){
echo "<ul class='following-list'>
<li id='".$row['following']."'><img src='profilepic/default.jpg' style='width:40px; height:40px; float:left; border:2px solid white; border-radius:5px;'><a href='profile.php'><span style='margin-left:2px; margin-top:5px; display:inline-block; font-weight:400; color:white;'>".$row['following']."</span></a></li><br />
</ul>";
}elseif ($row['profile_pic']=='' && $row['username']!=$user) {
echo "<ul class='following-list'>
<li id='".$row['following']."'><img src='profilepic/default.jpg' style='width:40px; height:40px; float:left; border:2px solid white; border-radius:5px;'><a href='info.php?id=".base64_encode($row['following'])."'><span style='margin-left:2px; margin-top:5px; display:inline-block; font-weight:400; color:white;'>".$row['following']."</span></a></li><br />
</ul>";
}elseif ($row['profile_pic']!='' && $row['username']==$user) {
echo "<ul class='following-list'>
<li id='".$row['following']."'><img src='profilepic/".$row['profile_pic']."' style='width:40px; float:left; height:40px; border:2px solid white; border-radius:5px;'><a href='profile.php'><span style='margin-left:2px; margin-top:5px; display:inline-block; font-weight:400; color:white;'>".$row['following']."</span></a></li><br />
</ul>";
}
else{
echo "<ul class='following-list'>
<li id='".$row['following']."'><img src='profilepic/".$row['profile_pic']."' style='width:40px; float:left; height:40px; border:2px solid white; border-radius:5px;'><a href='info.php?id=".base64_encode($row['following'])."'><span style='margin-left:2px; margin-top:5px; display:inline-block; font-weight:400; color:white;'>".$row['following']."</span></a></li><br />
</ul>";
}
}
}else{
echo "This user is not on this list";
}
}
?>
<?php
mysqli_close($conn);
}
?>