-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfriends.php
115 lines (58 loc) · 2.29 KB
/
friends.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
<?php $carousel="no";
include ( "./inc/header.inc.php");
if(!$userid){
die("You must be logged in to view this page");
}include ( "./inc/header-logged.inc.php");
?>
<br><br><br><br>
<div class="profile--wrapper"><br>
<!--<div class="heading--people">
<p>Find People Here!</p>
</div>-->
<input type="text" id="myInput1" onkeyup="myFunction()" placeholder="Search for names.." title="Type in a name">
<table id="myTable" align="center">
<tr style="display:none;">
<th style="width:20%;"></th>
<th style="width:60%;"></th>
<th style="width:20%;"></th>
</tr>
<?php
$get_user=DB::query('SELECT first_name, last_name, username, userdata FROM users');
foreach($get_user as $details){
$fname=$details['first_name'];
$lname=$details['last_name'];
$uname=$details['username'];
$udata=$details['userdata'];
if($username != $uname){
?>
<tr>
<td align="center"><img src="<?php print $_SERVER['MYVAR'];?>assets/userdata/<?php echo $udata;?>/dp.jpg" height="120" style="border-radius: 50%" alt="" target="_blank"></td>
<td align><a href="<?php print $_SERVER['MYVAR'];?>profile.php?user=<?php echo $uname;?>" target="_blank" class="find-name"><?php echo $fname." ".$lname;?></a></td>
<td align="center"><a href="<?php print $_SERVER['MYVAR'];?>messenger.php?to=<?php echo $uname?>" class="contact__final" target="_blank">Message</a></td>
</tr>
<?php
}
}
?>
</table>
</div>
<script>
function myFunction() {
var input, filter, table, tr, td, i, txtValue;
input = document.getElementById("myInput");
filter = input.value.toUpperCase();
table = document.getElementById("myTable");
tr = table.getElementsByTagName("tr");
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[1];
if (td) {
txtValue = td.textContent || td.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}
</script>