-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsearch.php
More file actions
355 lines (315 loc) · 14.4 KB
/
search.php
File metadata and controls
355 lines (315 loc) · 14.4 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
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
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
<?php
// Page-specific variables
$current_page = 'search';
$page_subtitle = 'Search Results';
$page_description = '';
$page_title = 'Search';
$page_title_thin = 'Results';
// Initialize session
if (!isset($_SESSION)) {
session_start();
}
// Include database configuration
define('WDS_SYSTEM', true);
require_once 'includes/db-config.php';
// Get search query
$search_query = isset($_GET['q']) ? trim($_GET['q']) : '';
$search_results = [];
$total_results = 0;
/**
* Enhanced search function that searches through all website content
*/
function searchWebsiteContent($query) {
$results = [];
// Define searchable pages with better descriptions
$static_pages = [
'index.php' => [
'title' => 'Home - Runlevel Systems',
'description' => 'Main homepage featuring our company overview, services, and development philosophy.',
'keywords' => 'home, main, company, overview, development, software, runlevel systems'
],
'projects.php' => [
'title' => 'What We\'ve Built - Products and Platforms',
'description' => 'Our portfolio of active products, live platforms, and development initiatives across games and operations software.',
'keywords' => 'what we have built, portfolio, products, platforms, games, software, work'
],
'joinus.php' => [
'title' => 'Join Us - Career Opportunities',
'description' => 'Information about joining our development team and co-op opportunities.',
'keywords' => 'jobs, careers, employment, join, team, co-op, opportunities'
],
'contact.php' => [
'title' => 'Contact - Get In Touch',
'description' => 'Contact information and ways to reach our development team.',
'keywords' => 'contact, email, phone, reach, communication, support'
],
'coop-journey.php' => [
'title' => 'Co-op Journey - Development Experience',
'description' => 'Information about our cooperative development program and student opportunities.',
'keywords' => 'co-op, cooperative, student, experience, journey, program'
]
];
// Define project pages with detailed information
$project_pages = [
'projects/alien-apocalypse.php' => [
'title' => 'Alien Apocalypse - Strategic Gaming',
'description' => 'Strategic gaming project featuring alien invasion scenarios and tactical gameplay.',
'keywords' => 'alien, apocalypse, strategy, gaming, tactical, invasion'
],
'projects/bbs-revival.php' => [
'title' => 'BBS Revival - Bulletin Board System',
'description' => 'Modern revival of classic bulletin board systems with contemporary features.',
'keywords' => 'bbs, bulletin, board, system, revival, classic, modern'
],
'projects/gameservers-world.php' => [
'title' => 'GameServers World - Gaming Infrastructure',
'description' => 'Gaming server infrastructure and hosting solutions for multiplayer games.',
'keywords' => 'gameservers, gaming, infrastructure, hosting, multiplayer, servers'
],
'projects/neverwards.php' => [
'title' => 'Neverwards - Adventure Gaming',
'description' => 'Adventure gaming project with immersive storytelling and exploration.',
'keywords' => 'neverwards, adventure, gaming, story, exploration, immersive'
],
'projects/pureops.php' => [
'title' => 'PureOps - Operations Management',
'description' => 'Business operations management system for streamlined workflows.',
'keywords' => 'pureops, operations, management, business, workflow, system'
],
'projects/roadkill-v2.php' => [
'title' => 'Roadkill V2 - Enhanced Racing',
'description' => 'Enhanced version of our racing game with improved graphics and gameplay.',
'keywords' => 'roadkill, racing, enhanced, graphics, gameplay, version'
],
'projects/roadkill.php' => [
'title' => 'Roadkill - Original Racing Game',
'description' => 'Original racing game project featuring high-speed action and competitive gameplay.',
'keywords' => 'roadkill, racing, original, action, competitive, speed'
],
'projects/space-4x.php' => [
'title' => 'Space 4X - Strategy Gaming',
'description' => 'Space-based 4X strategy game with exploration, expansion, exploitation, and extermination.',
'keywords' => 'space, 4x, strategy, exploration, expansion, exploitation, extermination'
],
'projects/worlddomination-dev.php' => [
'title' => 'World Domination Dev - Development Tools',
'description' => 'Internal development tools and utilities for project management and collaboration.',
'keywords' => 'development, tools, utilities, management, collaboration, internal'
],
'projects/gameserver-panel.php' => [
'title' => 'GameServer Panel - Open Game Panel Fork',
'description' => 'Enhanced fork of Open Game Panel (OGP) with commercial billing, multi-location management, and enterprise features for game hosting providers.',
'keywords' => 'gameserver, panel, ogp, open, game, hosting, billing, commercial, enterprise, server, management'
],
'projects/gameserver-panel-industry-stats.php' => [
'title' => 'Gaming Industry Statistics 2025 - Market Analysis',
'description' => '2025 gaming industry market analysis with interactive charts showing $268B market size, platform distribution, demographics, and hosting opportunities.',
'keywords' => 'gaming, industry, statistics, market, analysis, charts, revenue, demographics, hosting, opportunities'
]
];
$all_pages = array_merge($static_pages, $project_pages);
foreach ($all_pages as $file => $page_info) {
$file_path = __DIR__ . '/' . $file;
$relevance_score = 0;
$snippet = '';
if (file_exists($file_path)) {
$content = file_get_contents($file_path);
$clean_content = strip_tags($content);
$clean_content = preg_replace('/\s+/', ' ', $clean_content);
// Check title match (highest priority)
if (stripos($page_info['title'], $query) !== false) {
$relevance_score += 10;
}
// Check description match (medium priority)
if (stripos($page_info['description'], $query) !== false) {
$relevance_score += 5;
}
// Check keywords match (medium priority)
if (stripos($page_info['keywords'], $query) !== false) {
$relevance_score += 3;
}
// Check content match (lower priority but important)
$content_matches = substr_count(strtolower($clean_content), strtolower($query));
if ($content_matches > 0) {
$relevance_score += $content_matches;
// Extract snippet around the first match
$snippet_start = stripos($clean_content, $query);
$start = max(0, $snippet_start - 100);
$snippet = substr($clean_content, $start, 300);
$snippet = preg_replace('/(' . preg_quote($query, '/') . ')/i', '<mark>$1</mark>', $snippet);
if ($start > 0) $snippet = '...' . $snippet;
if (strlen($clean_content) > $start + 300) $snippet .= '...';
} else {
$snippet = $page_info['description'];
}
// If we have any relevance, add to results
if ($relevance_score > 0) {
$results[] = [
'title' => $page_info['title'],
'url' => $file,
'snippet' => $snippet,
'description' => $page_info['description'],
'relevance' => $relevance_score
];
}
}
}
// Sort results by relevance score (highest first)
usort($results, function($a, $b) {
return $b['relevance'] - $a['relevance'];
});
return $results;
}
if (!empty($search_query)) {
$search_results = searchWebsiteContent($search_query);
$total_results = count($search_results);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/png" href="/assets/images/RL-icon.png">
<title>Search Results - Runlevel Systems</title>
<!-- CSS -->
<link href="assets/css/coreloop.css" rel="stylesheet">
<style>
.search-results {
background-color: #071228;
color: #eaf3ff;
padding: 40px 0;
min-height: 500px;
}
.search-result-item {
background-color: transparent;
border: none;
border-radius: 0;
padding: 20px;
margin-bottom: 20px;
transition: all 0.3s ease;
}
.search-result-item:hover {
transform: translateY(-2px);
}
.search-result-title {
color: #00d4ff;
font-size: 18px;
font-weight: bold;
margin-bottom: 10px;
}
.search-result-title a {
color: #00d4ff;
text-decoration: none;
}
.search-result-title a:hover {
color: #ffd166;
text-decoration: underline;
}
.search-result-snippet {
color: #a8bedc;
line-height: 1.6;
font-size: 14px;
}
.search-result-url {
color: #7894b9;
font-size: 12px;
margin-top: 10px;
}
.search-stats {
color: #ffbe55;
margin-bottom: 30px;
font-size: 14px;
}
.no-results {
text-align: center;
color: #a8bedc;
font-size: 16px;
padding: 50px 0;
}
.search-form-page {
background-color: transparent;
padding: 20px;
border-radius: 0;
margin-bottom: 30px;
}
mark {
background-color: rgba(54,243,255,0.24);
color: #eaf3ff;
padding: 2px 4px;
border-radius: 2px;
}
</style>
</head>
<body>
<!-- Include Site Header -->
<?php include 'includes/header.php'; ?>
<!-- Include Navigation Header -->
<?php include 'includes/navigation.php'; ?>
<section class="search-results">
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<!-- Search Form -->
<div class="search-form-page wds-card">
<form method="GET" action="search.php">
<div class="input-group">
<input type="text" name="q" class="form-control" placeholder="Search Runlevel Systems..." value="<?php echo htmlspecialchars($search_query); ?>">
<span class="input-group-btn">
<button class="btn btn-default btn-wds" type="submit">
<i class="ion-search" aria-hidden="true"></i> Search
</button>
</span>
</div>
</form>
</div>
<?php if (!empty($search_query)): ?>
<!-- Search Statistics -->
<div class="search-stats">
Found <?php echo $total_results; ?> result<?php echo $total_results !== 1 ? 's' : ''; ?> for "<?php echo htmlspecialchars($search_query); ?>"
</div>
<?php if ($total_results > 0): ?>
<!-- Search Results -->
<?php foreach ($search_results as $result): ?>
<div class="search-result-item wds-card">
<div class="search-result-title">
<a href="<?php echo htmlspecialchars($result['url']); ?>">
<?php echo htmlspecialchars($result['title']); ?>
</a>
</div>
<div class="search-result-snippet">
<?php echo $result['snippet']; ?>
</div>
<div class="search-result-url">
<?php echo htmlspecialchars($result['url']); ?>
</div>
</div>
<?php endforeach; ?>
<?php else: ?>
<div class="no-results">
<h3>No results found</h3>
<p>Sorry, no pages were found matching your search criteria.</p>
<p>Try using different keywords or check your spelling.</p>
</div>
<?php endif; ?>
<?php else: ?>
<div class="no-results">
<h3>Search Runlevel Systems</h3>
<p>Enter your search terms above to find content across our website.</p>
</div>
<?php endif; ?>
</div>
</div>
</div>
</section>
<!-- Include Footer -->
<?php include 'includes/footer.php'; ?>
<!-- JavaScript -->
<script src="assets/js/jquery-1.12.3.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/jquery.magnific-popup.min.js"></script>
<script src="assets/js/owl.carousel.min.js"></script>
<script src="assets/js/script.js"></script>
</body>
</html>