-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathleft-col.php
59 lines (48 loc) · 1.48 KB
/
left-col.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
<div id="left-col-container">
<div style="cursor: pointer; background: #F4A460; padding: 1.5px;" onclick="document.getElementById('new-message').style.display='block'" class="white-back">
<p align="center">Click here to send message to new user</p>
</div>
<?PHP
$q='SELECT DISTINCT `reciever_name`, `sender_name`
FROM `messages` WHERE
`sender_name`= "'.$_SESSION['Username'].'" OR `reciever_name`= "'.$_SESSION['Username'].'"';
$r = mysqli_query($con, $q);
if($r){
if(mysqli_num_rows($r)>0){
$counter = 0 ;
$added_user = array() ;
while($row= mysqli_fetch_assoc($r)){
$sender_name= $row['sender_name'];
$reciever_name= $row['reciever_name'];
if($_SESSION['Username']== $sender_name){
if(in_array($reciever_name, $added_user)){
}else{
?>
<div class="grey-back">
<img src="inside.png" class="image"/><?Php echo '<a href="?user='.$reciever_name.'">'.$reciever_name.'</a>' ; ?>
</div>
<?php
$added_user = array($counter => $reciever_name) ;
$counter++ ;
}
}elseif($_SESSION['Username']== $reciever_name){
if(in_array($sender_name, $added_user)){
}else{
?>
<div class="grey-back">
<img src="inside.png" class="image"/><?Php echo '<a href="?user='.$sender_name.'">'.$sender_name.'</a>' ; ?>
</div>
<?Php
$added_user = array($counter => $sender_name) ;
$counter++ ;
}
}
}
}else{
echo 'no user';
}
}else{
echo $q;
}
?>
</div>