This repository has been archived by the owner on May 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.php
296 lines (266 loc) · 12.8 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
<?php
include("config.php");
include("classes/SiteResultsProvider.php");
include("classes/ImageResultsProvider.php");
if(isset($_GET["term"])){
$term = $_GET["term"];
}else{
exit("please letter search > 0");
}
$type = isset($_GET["type"]) ? $_GET["type"] : "sites";
$page = isset($_GET["page"]) ? $_GET["page"] : 1;
?>
<!doctype html>
<html lang="en">
<head>
<title>
<?php echo $term; ?> - Mr. Foxie
</title>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="shortcut icon" href="assets/images/mrfoxie.png" type="image/x-icon">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body {
background-color: #ffffff;
background-image: url('assets/images/hacked.jpg');
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
margin-bottom: 10%;
word-wrap: break-word;
text-align: justify;
}
.row {
background-color: #ffffff;
}
input.form-control {
background-color: transparent;
color: #f42b03;
border-color: #f42b03;
}
input[type="text"]:focus {
background-color: transparent;
border-color: #ffffff;
color: #ffffff;
box-shadow: inset 0px 0px 10px #f42b03, 0px 0px 10px #f42b03;
}
input[type="text"]::placeholder {
color: #f42b03;
}
.btn {
color: #0c0c0c;
background-color: #f42b03;
border: 1px solid #ffffff;
}
.btn:hover {
background-color: transparent;
border-color: #ffffff;
box-shadow: inset 0px 0px 10px #f42b03, 0px 0px 10px #f42b03;
}
.navbar {
position: sticky;
top: 0;
left: 0;
right: 0;
margin: auto;
z-index: 99;
background-color: #ffffff;
border-color: #f42b03;
border-bottom: 1px solid #f42b03;
box-shadow: 0px 05px 10px #f42b03;
}
.col-lg-8 {
left: 0;
right: 0;
margin: auto;
padding: 20px;
background-color: #f5f5f5;
}
a {
color: #f42b03;
}
a:hover {
color: #0c0c0c;
}
a.result {
color: #f42b03;
}
a.result:hover {
transition: 0.3s;
color: #0c0c0c;
text-shadow: 0px 0px 10px #f42b03;
}
.resultsCount {
color: #0c0c0c;
}
.url,
.details {
color: #f42b03aa;
}
.details:hover {
transition: 0.3s;
color: #0c0c0c;
text-shadow: 0px 0px 10px #f42b03;
}
.description {
color: #0c0c0c;
}
.resultsCount {
font-size: 10px;
}
.page-item {
background-color: #f42b03;
}
.page-link {
border: none;
color: #0c0c0c;
background-color: #f42b03;
}
.page-item.active .page-link {
border: 1px solid #f42b03;
background-color: #f42b03;
border-radius: 0rem;
}
li.page-item:hover a.page-link {
transition: 0.3s;
color: #0c0c0c;
border: 1px solid #f42b03;
background-color: transparent;
box-shadow: inset 0px 0px 10px #f42b03, 0px 0px 10px #f42b03;
border-radius: 0rem;
}
div.dropdown-menu.show {
text-align: center;
background-color: #ffffff;
border: none;
}
a.dropdown-item {
color: #ffffff;
}
a.dropdown-item:hover {
transition: 0.6s;
color: #ffffff;
background-color: #0c0c0c;
}
i,
strong {
color: #f42b03;
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-md navbar-ligh text-dark">
<img class="navbar-brand" src="assets/images/mrfoxie.png" width="30" alt="">
<a class="navbar-brand" href="/">Mr. Foxie</a>
<button style="color:#ffffff; border:1px solid #ffffff; box-shadow: inset 0px 0px 10px #f42b03, 0px 0px 10px #f42b03;" class="navbar-toggler d-lg-none" type="button" data-toggle="collapse" data-target="#collapsibleNavId" aria-controls="collapsibleNavId"
aria-expanded="true" aria-label="Toggle navigation">@</button>
<div class="collapse navbar-collapse" id="collapsibleNavId">
<ul class="navbar-nav mr-auto mt-2 mt-lg-0">
<li class="<?php echo $type == 'sites' ? 'active' : '' ?>">
<a class="nav-link" href="<?php echo " search.php?term=$term&type=sites "; ?>">All links <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="dropdownId" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Others</a>
<div class="dropdown-menu" aria-labelledby="dropdownId">
<a class="dropdown-item" href="submit-url.php" target="_blank"><i class="fa fa-upload fa-lg" aria-hidden="true"></i></a>
<a class="dropdown-item" href="https://t.me/MrFoxie" target="_blank"><i class="fa fa-telegram fa-lg" aria-hidden="true"></i></a>
<a class="dropdown-item" href="https://github.com/mrfoxie/search" target="_blank"><i class="fa fa-github-alt fa-lg" aria-hidden="true"></i></a>
</div>
</li>
</ul>
<p class="my-2 my-lg-2 text-dark">
<?php echo $type; ?>:
<?php echo $term; ?>
</div>
</nav>
<br>
<div class="container">
<div class="row">
<div class="col-md-4">
<div class="card" style="background-color:transparent; border:none;">
<img class="card-img-top" src="assets/images/mrfoxie.png" alt="logo">
<div class="card-body">
<h4 class="card-title">
Search Word:
<?php echo $term; ?>
</h4>
<p class="card-text"><strong>Welcome Foxie!!!</strong> to Mr. Foxie. If you like it then you can donate me on <a href="https://paypal.me/mistrysiddh" target="_blank" rel="noopener noreferrer"><i class="fa fa-paypal fa-lg" aria-hidden="true"></i></a>.</p>
<div class="card">
<div class="card-header">
Quote
</div>
<div class="card-body">
<blockquote class="blockquote mb-0">
<p>If you win, you live.<br>If you lose, you die.<br>If you don’t fight,<br>you can’t win.</p>
<footer class="blockquote-footer"><cite title="Mechatronics Forum">Mr. Foxie</cite></footer>
</blockquote>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-8">
<?php
if($type == "sites"){
$resultsProvider = new SiteResultsProvider($con);
$pageLimit = 20;
}else{
$resultsProvider = new ImageResultsProvider($con);
$pageLimit = 30;
}
$numResults = $resultsProvider->getNumResults($term);
echo "<p class='resultsCount'>About $numResults results have been found in the database.</p>";
echo $resultsProvider->getResultsHtml($page, $pageLimit, $term);
?>
</div>
<div class="col-xl-12">
<br>
<nav aria-label="Page navigation">
<ul class="pagination pagination-md justify-content-center">
<?php
$pagesToShow = 10;
$pageSize = 20;
$numPages = ceil($numResults / $pageSize);
$pageLefts = min($pagesToShow, $numPages);
$currentPage = $page - floor( $pagesToShow / 2 );
if($currentPage < 1){
$currentPage = 1;
}
if($currentPage + $pageLefts > $numPages + 1) {
$currentPage = $numPages + 1 - $pageLefts; // thì số trang hiện tại bằng tổng số trang + 1 - số trang còn lại
}
while($pageLefts != 0 && $currentPage <= $numPages) {
if($currentPage == $page){
echo "
<li class='page-item active' aria-current='page'>
<span class='page-link'>$currentPage<span class='sr-only'>(current)</span></span>
</li>";
}else{
echo "
<li class='page-item'><a class='page-link' href='search.php?term=$term&type=$type&page=$currentPage'>$currentPage</a></li>";
}
$currentPage++;
$pageLefts--;
}
?>
</ul>
</nav>
</div>
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.3.5/jquery.fancybox.min.js"></script>
<script src="https://unpkg.com/masonry-layout@4/dist/masonry.pkgd.min.js"></script> -->
<script type="text/javascript" src="assets/js/script.js"></script>
</body>
</html>