-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.php
More file actions
61 lines (57 loc) · 1.98 KB
/
search.php
File metadata and controls
61 lines (57 loc) · 1.98 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
<?php
session_start();
include('conn.php');
?>
<div class="text-muted">
Results for <span class="bg-white font-weight-bold "><?php echo($_POST['searchTerm']);?></span>
<hr>
</div>
<div class="row justify-content-center">
<?php
$user_identity=$_SESSION['login'];
$searchTerm=mysqli_real_escape_string($con,$_POST['searchTerm']);
$selectallusers=mysqli_query($con,"SELECT * FROM users where username like'%{$searchTerm}%' and users.unique_id!='$user_identity'");
if ($selectallusers) {
if (mysqli_num_rows($selectallusers)>0) {
while ($fetchalluser=mysqli_fetch_array($selectallusers)) {
$user_to_follow=$fetchalluser['unique_id'];
?>
<div class="col-lg-5">
<div class="d-flex flex-row mt-2 border p-2 bg-white rounded">
<div class=" text-white p-2 text-center userprofileliked">
<?php
$new=$fetchalluser['username'];
$upper_name=strtoupper($new);
$nee=substr(($upper_name),0,1);
echo("<h3>".$nee."</h3>");
?>
</div>
<div class="flex-fill mt-3 ml-3">
<a href="user.php?unique_id_profile=<?php echo($fetchalluser['unique_id']) ?>"><?php echo$fetchalluser['username']?></a>
</div>
<div class="mt-3">
<?php include"c_php/followbtn.php"?>
</div>
<div class="mt-3 ml-2">
<?php if (mysqli_num_rows($selectcfollowing)>0) { ?>
<a class="btn <?php echo"follow"?> btn-sm" href="messages.php?unique_id_profile=<?php echo($user_identity)?>&usercontroller='messangerController'&unique_id_profile_receiver=<?php echo($user_to_follow)?>&messangerController='messagesAPi'&type=0">Message</a>
<?php }?>
</div>
</div>
<hr>
</div>
<?php
}
}else{
?>
<div class="text-muted">
<p>No Search results found</p>
</div>
<?php
}
}else{
$message="<div class='d-flex flex-row error'>
<div class='flex-fill'>".$con->error."</div><div class='ml-2 disabled'><i class='fa fa-times-circle'></i></div></div>";
}
?>
</div>