-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsearch.php
87 lines (79 loc) · 3.21 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
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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php echo $_GET['search']?> | eDiscuss</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
<link rel="shortcut icon" href="/eForum/photos/logo-2.svg" type="image/x-icon" />
<style>
.carousel-inner>.carousel-item>img {
width: 1500px;
height: 400px;
}
#container {
min-height: 87.5vh;
}
html,
body {
width: 100%;
height: 100%;
}
body {
/* background: linear-gradient(45deg, #ee7752, #23d5ab, #23a6d5, #23d5ab); */
background: linear-gradient(45deg, #7393B3, #D3D3D3, #B2BEB5, #C0C0C0);
background-size: 400% 400%;
animation: gradient 10s ease infinite;
}
</style>
</head>
<body>
<?php include 'partials/_dbconnect.php'; ?>
<?php include 'partials/_header.php'; ?>
<!-- search results -->
<div class="container" id="container">
<h1 class="my-3">Search results for <em>"<?php echo $_GET['search']?>"</em></h1>
<?php
$noResult = true;
$query = $_GET['search'];
$sql = "SELECT * FROM `threads` WHERE MATCH(thread_title,thread_desc) against('$query');";
$result = mysqli_query($conn, $sql);
while ($row = mysqli_fetch_assoc($result)) {
$title = $row['thread_title'];
$desc = $row['thread_desc'];
$thread_id = $row['thread_id'];
$url = "thread.php?threadid=".$thread_id;
$noResult = false;
//Display search results
echo '<div class="result">
<h3><a href="'.$url.'" class="text-dark">'.$title.'</a></h3>
<p>'.$desc.'</p>
</div>';
}
if($noResult){
echo '<div class="container" id="ques">
<div class="jumbotron jumbotron-fluid">
<div class="container">
<h1 class="display-6">No Results Found!!</h1>
<p class="lead">Suggestions: <ul>
<li>Make sure that all words are spelled correctly.</li>
<li>Try different keywords.</li>
<li>Try more general keywords. </li></ul></p>
</div>
</div> </div>';
}
?>
</div>
<?php include 'partials/_footer.php'; ?>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous">
</script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js"
integrity="sha384-oBqDVmMz9ATKxIep9tiCxS/Z9fNfEXiDAYTujMAeBAsjFuCZSmKbSSUnQlmh/jp3" crossorigin="anonymous">
</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"
integrity="sha384-mQ93GR66B00ZXjt0YO5KlohRA5SY2XofN4zfuZxLkoj1gXtW8ANNCe9d5Y3eG5eD" crossorigin="anonymous">
</script>
</body>
</html>