-
Notifications
You must be signed in to change notification settings - Fork 0
/
get-user.php
42 lines (40 loc) · 1.36 KB
/
get-user.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
<?php
if(isset($_REQUEST['name']) && $_REQUEST['name'] !== ""){
if(!session_id())
session_start();
$username = $_SESSION['username'];
$name = strip_tags($_REQUEST['name']);
include_once("functions.php");
$conn = get_connection_handle();
$result = $conn->query("select firstname,lastname,username from users where
username <> '$username' and username like '%$name%' or firstname like '%$name%' or
lastname like '%$name%' or user_id like '%$name%' limit 10");
if($result->num_rows > 0){
echo "<ul class='list-group'>";
while($row = $result->fetch_object()){
$real_name = $row->firstname." ".$row->lastname;
$user = $row->username;
$usr = <<<USER
<li class="list-group-item">
<div class="custom-control custom-radio mr-3">
<input type="radio" id="$user" name="user" value="$user" class="custom-control-input user"/>
<label class='custom-control-label' for="$user">$real_name</label>
</div>
</li>
USER;
echo $usr;
}
echo "</ul>";
}else{
echo "No matches were found";
}
}else{
header("Location:.");
}
?>
<script>
$(".user").on("input", function(){
var val = $(this).val();
$("#omgUser").val(val)
});
</script>