-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetinfofollowers.php
113 lines (110 loc) · 5.83 KB
/
getinfofollowers.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
<?php
if(!isset($_COOKIE['user']) || !isset($_COOKIE['email'])){
header('Location:index.php');
}else{
date_default_timezone_set('Africa/Lagos');
require 'db.php';
?>
<?php
$username=$_POST['username'];
$currentname=$_COOKIE['user'];
$sql="SELECT * FROM followership INNER JOIN artiste_info ON followership.follower=artiste_info.username WHERE followership.following='$username'";
$result=mysqli_query($conn,$sql);
if(mysqli_num_rows($result) > 0){
while($row=mysqli_fetch_assoc($result)){
$tounfollow=$row['follower'];
$sql3="SELECT follower FROM followership WHERE follower='$currentname' AND following='$tounfollow'";
$result3=mysqli_query($conn,$sql3);
if(mysqli_num_rows($result3) > 0){
$clearusername=$_COOKIE['user'];
if($row['profile_pic']=='' && $row['username']!=$clearusername){
echo "<ul class='following-list'>
<li><img src='profilepic/default.jpg' id='following-profile-pic'><a href='info.php?id=".base64_encode($row['follower'])."'><span style='margin-left:2px; margin-top:20px; display:inline-block; font-weight:bold; color:black;'>".$row['follower']."</span></a><form method='POST' style='float:right; margin-top:10px;' id='unfollow-form' action='unfollow.php' class='ajax' value='".$row['follower']."'>
<input type='hidden' name='following' value='".$row['follower']."'>
<input type='hidden' name='follower' value='".$_COOKIE['user']."'>
<button type='submit' name='unfollow' onclick='callaction()' class='".$row['follower']."' id='unfollow-button'>unfollow</button>
</form></li><br />
</ul>";
}
elseif ($row['profile_pic']!='' && $row['username']!=$clearusername) {
echo "<ul class='following-list'>
<li><img src='profilepic/".$row['profile_pic']."' id='following-profile-pic'><a href='info.php?id=".base64_encode($row['follower'])."'><span style='margin-left:2px; margin-top:20px; display:inline-block; font-weight:bold; color:black;'>".$row['follower']."</span></a><form method='POST' style='float:right; margin-top:10px;' id='unfollow-form' action='unfollow.php' class='ajax' value='".$row['follower']."'>
<input type='hidden' name='following' value='".$row['follower']."'>
<input type='hidden' name='follower' value='".$_COOKIE['user']."'>
<button type='submit' name='unfollow' onclick='callaction()' class='".$row['follower']."' name='unfollow' id='unfollow-button'>unfollow</button>
</form></li><br />
</ul>";
}
elseif ($row['profile_pic']!='' && $row['username']==$clearusername) {
echo "<ul class='following-list'>
<li><img src='profilepic/".$row['profile_pic']."' id='following-profile-pic'><a href='profile.php'><span style='margin-left:2px; margin-top:20px; display:inline-block; font-weight:bold; color:black;'>".$row['follower']."</span></a></li><br />
</ul>";
}
else{
echo "<ul class='following-list'>
<li><img src='profilepic/default.jpg' id='following-profile-pic'><a href='profile.php'><span style='margin-left:2px; margin-top:20px; display:inline-block; font-weight:bold; color:black;'>".$row['follower']."</span></a></li><br />
</ul>";
}
}else{
$clearusername=$_COOKIE['user'];
if($row['profile_pic']==''&& $row['username']!=$clearusername){
echo "<ul class='following-list'>
<li><img src='profilepic/default.jpg' id='following-profile-pic'><a href='info.php?id=".base64_encode($row['follower'])."'><span style='margin-left:2px; margin-top:20px; display:inline-block; font-weight:bold; color:black;'>".$row['follower']."</span></a><form method='POST' style='float:right; margin-top:10px;' class='ajax' action='follow.php'>
<input type='hidden' name='following' value='".$row['follower']."'>
<input type='hidden' name='username' value='".$_COOKIE['user']."'>
<button type='submit' name='follow' class='".$row['follower']."' id='unfollow-button'>follow</button>
</form></li><br />
</ul>";
}elseif($row['profile_pic']!='' && $row['username']!=$clearusername){
echo "<ul class='following-list'>
<li><img src='profilepic/".$row['profile_pic']."' id='following-profile-pic'><a href='info.php?id=".base64_encode($row['follower'])."'><span style='margin-left:2px; margin-top:20px; display:inline-block; font-weight:bold; color:black;'>".$row['follower']."</span></a><form method='POST' style='float:right; margin-top:10px;' class='ajax' action='follow.php'>
<input type='hidden' name='following' value='".$row['follower']."'>
<input type='hidden' name='username' value='".$_COOKIE['user']."'>
<button type='submit' name='follow' class='".$row['follower']."' id='unfollow-button'>follow</button>
</form></li><br />
</ul>";
}
elseif ($row['profile_pic']!='' && $row['username']==$clearusername) {
echo "<ul class='following-list'>
<li><img src='profilepic/".$row['profile_pic']."' id='following-profile-pic'><a href='profile.php'><span style='margin-left:2px; margin-top:20px; display:inline-block; font-weight:bold; color:black;'>".$row['follower']."</span></a></li><br />
</ul>";
}
else{
echo "<ul class='following-list'>
<li><img src='profilepic/default.jpg' id='following-profile-pic'><a href='profile.php'><span style='margin-left:2px; margin-top:20px; display:inline-block; font-weight:bold; color:black;'>".$row['follower']."</span></a></li><br />
</ul>";
}
}
}
}else{
echo "";
}
?>
<script type="text/javascript">
$('form.ajax').on('submit' ,function(e){
var that= $(this),
url= that.attr('action'),
type=that.attr('method'),
data={};
that.find('[name]').each(function(index, value){
var that = $(this),
name=that.attr('name'),
value=that.val();
data[name]=value;
});
e.stopImmediatePropagation();
$.ajax({
url:url,
type:type,
data:data,
success:function(response){
$("body").append(response);
}
});
return false;
});
</script>
<?php
mysqli_close($conn);
}
?>