-
Notifications
You must be signed in to change notification settings - Fork 1
/
search.php
45 lines (45 loc) · 1.67 KB
/
search.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
<?php
require "config/config.php";
session_start();
if (!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true) {
header("location: login.php?redirect_link=search.php");
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height">
<title>Search</title>
<link rel="shortcut icon" href="logos/logo.png" type="image/x-icon">
<script src="jquery/jquery.js"></script>
<link rel="stylesheet" href="css/search.css?v=<?php echo time(); ?>">
<script>
$(document).ready(function() {
$('.user-input').on("keyup input", function() {
var inputVal = $(this).val();
var resultDropdown = $(this).siblings(".result");
if (inputVal.length) {
$.get("actions.php?action=search_user", {username: inputVal}).done(function(data) {
resultDropdown.html(data);
});
} else {
resultDropdown.empty();
}
});
});
</script>
</head>
<body>
<?php require_once("header.php"); ?>
<div style="margin: 20px;">
<h1>Enter someone's username ...</h1>
<div class="search-box">
<input type="text" autocomplete="off" placeholder="Enter name" class="user-input" />
<div class="result"></div>
</div>
</div>
</body>
</html>