-
Notifications
You must be signed in to change notification settings - Fork 7
/
acquaintances.php
154 lines (114 loc) · 3.86 KB
/
acquaintances.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
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
<?php
include'core/init.php';
protect_page();
include'includes/overall/header.php';
?>
<h3></h3>
<div id="friendsbutton">
<ul>
<li><?php echo "<a href='friends.php'>Friends</a>"?> </li>
<li><?php echo "<a href='acquaintances.php'>Acquaintances</a>"?> </li>
<li><?php echo "<a href='following.php'>Following</a>"?> </li>
<li><?php echo "<a href='followers.php'>Followers</a>"?> </li>
<li><?php echo "<a href='alumnus.php'>Alumni</a>"?> </li>
<li><?php echo "<a href='faculty.php'>Faculty</a>"?> </li>
</ul>
</div>
<?php
$user2= $_SESSION['user_id'];
$querya="SELECT `user_one`,`user_two` FROM acquaintances WHERE (`user_one`='$user2') OR
( `user_two`='$user2')";
$friends_query=mysqli_query( $con ,$querya);
$flag=1;
while($run_mem = mysqli_fetch_array($friends_query)){
$user_one=$run_mem['user_one'];
$user_two=$run_mem['user_two'];
if($user_one==$user2){
$usera=$user_two;
}
else{
$usera=$user_one;
}
// getuser via $field
$sqli = "SELECT * FROM `users` WHERE `user_id`='$usera' ";
$queryy = mysqli_query($con, $sqli);
while($run_memo = mysqli_fetch_array($queryy))
{
if($flag%2==0){
?>
<div class="right_friend">
<?php
$usernamee=$run_memo['username'];
$firstname=$run_memo['first_name'];
$lastname=$run_memo['last_name'];
echo "<br><br>";
?>
<div class="profilepic">
<?php
echo '<img src="',$run_memo['profile'],'" alt="',$run_memo['first_name'],'\'s Profile Image" >';
?>
</div>
<?php
echo "<br><br>";
echo "<a href='profile.php?username=$usernamee'class='box' style='display:block;'>$firstname $lastname</a>";
if(online_status($usera)==1){
echo "<img src='images/online.jpg' alt='Online' height='10' width='10'>";
}else{
echo "<img src='images/offline.png' alt='Offline' height='10' width='10'>";
}
?>
</div>
<?php
$flag=1;
}
else{
?>
<div class="left_friend">
<?php
$usernamee=$run_memo['username'];
$firstname=$run_memo['first_name'];
$lastname=$run_memo['last_name'];
echo "<br><br>";
?>
<div class="profilepic">
<?php
echo '<img src="',$run_memo['profile'],'" alt="',$run_memo['first_name'],'\'s Profile Image" >';
?>
</div>
<?php
echo "<br><br>";
echo "<a href='profile.php?username=$usernamee'class='box' style='display:block;'>$firstname $lastname</a>";
if(online_status($usera)==1){
echo "<img src='images/online.jpg' alt='Online' height='10' width='10'>";
}else{
echo "<img src='images/offline.png' alt='Offline' height='10' width='10'>";
}
?>
</div>
<?php
$flag=2;
}
}
}
/* $req_query=$con->query("SELECT `from` FROM friend_request WHERE `to`='$user2' ");
while($run_req=mysqli_fetch_array($req_query)){
$from = $run_req['from'];
$from_username=getuseridname($from);
echo $from_username;
}
$sql = "SELECT `user_one` FROM friend_request WHERE `to`='$user2' ";
$query = mysqli_query($con, $sql);
while($run_mem = mysqli_fetch_array($query)){
$id=$run_mem['from'];
// getuser via $field
$sqli = "SELECT * FROM users WHERE id='$id' ";
$queryy = mysqli_query($con, $sqli);
while($run_memo = mysqli_fetch_array($queryy)){
$usernamee=$run_memo['username'];
echo "<a href='profile.php?user=$id'class='box' style='display:block;'>$usernamee</a>";
echo "<br><br><br>";
}
}*/
?>
<?php include 'includes/overall/footer.php';
?>