-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget-all-members.php
More file actions
66 lines (47 loc) · 1.87 KB
/
Copy pathget-all-members.php
File metadata and controls
66 lines (47 loc) · 1.87 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
<div class="row">
<?php
if(!isset($_SESSION['friendslogin'])){
$users = mysqli_query($con,"SELECT * FROM user");
while($user = mysqli_fetch_assoc($users)){
?>
<div class="col-lg-3" style="padding:15px" >
<center>
<img width="120" height="120" style="border-radius: 120px" alt="Profile Picture" class="" src="images/users/<?php if($user['image']==''){ echo 'default.png'; }else{echo $user['image'];} ; ?>" />
<h5><?php echo $user['fullname']; ?></h5>
</center>
</div>
<?php
}
}else{
$users = mysqli_query($con,"SELECT * FROM user WHERE id != '{$_SESSION['logUserId']}'");
while($user = mysqli_fetch_assoc($users)){
?>
<div class="col-lg-3" style="padding:15px" >
<center>
<img width="120" height="120" style="border-radius: 120px" alt="Profile Picture" class="" src="images/users/<?php if($user['image']==''){ echo 'default.png'; }else{echo $user['image'];} ; ?>" />
<h5><?php echo $user['fullname']; ?></h5>
<p>Email : <?php echo $user['email']; ?> </p>
</center>
<?php
areFriends($user['id'] );
?>
</div>
<?php
}
}
function areFriends($userid){
include 'database.php';
if(mysqli_num_rows(mysqli_query($con,"SELECT * FROM connection WHERE (user1 ='$userid' AND user2 ='{$_SESSION['logUserId']}') OR (user2 ='$userid' AND user1 ='{$_SESSION['logUserId']}')"))!=0){
?>
<a href="chat.php?to=<?php echo $userid; ?>#sent" class="btn btn-primary btn-sm" href="">Message</a>
<a href="add-friend.php?remove=yes&friend=<?php echo $userid; ?>" class="btn btn btn-sm btn-warning" href="">Unfriend</a>
<?php
}else{
?>
<a href="chat.php?#sent" class="btn btn-disabled btn-sm disabled" href="">Message Not Available</a>
<a class="btn btn btn-sm btn-success" href="add-friend.php?add=yes&friend=<?php echo $userid; ?>">Add Friend</a>
<?php
}
}
?>
</div>