home
/
aioutajg
/
playpauseonline.com
/
pages
/
Go to Home Directory
+
Upload
Create File
root@0UT1S:~$
Execute
By Order of Mr.0UT1S
[DIR] ..
N/A
404.php
1.89 KB
Rename
Delete
about.php
4.24 KB
Rename
Delete
blog.php
4.38 KB
Rename
Delete
contact.php
3.20 KB
Rename
Delete
error_log
1.73 KB
Rename
Delete
index.php
0 bytes
Rename
Delete
main.php
22.72 KB
Rename
Delete
post.php
6.99 KB
Rename
Delete
privacy.php
4.67 KB
Rename
Delete
search.php
8.40 KB
Rename
Delete
terms.php
3.69 KB
Rename
Delete
<?php require_once __DIR__ . '/../admin/config.php'; // Security headers header("X-Content-Type-Options: nosniff"); header("X-Frame-Options: SAMEORIGIN"); header("X-XSS-Protection: 1; mode=block"); // Get search parameters $query = $_GET['q'] ?? ''; $page = max(1, (int)($_GET['page'] ?? 1)); $results_per_page = 10; $offset = ($page - 1) * $results_per_page; // Process search terms $search_terms = array_unique(array_filter(array_map('trim', explode(' ', $query)))); $boolean_query = implode('* +', $search_terms) . '*'; // Set page metadata $pageTitle = "Search Results for \"$query\" - " . SITE_NAME; $pageDescription = "Search results for \"$query\""; include '../includes/header.php'; ?> <?php $query = isset($_GET['q']) ? trim($_GET['q']) : ''; $page = isset($_GET['page']) ? intval($_GET['page']) : 1; $canonicalBase = SITE_URL . "/pages/search"; $canonicalParams = []; if ($query !== '') { $canonicalParams[] = 'q=' . urlencode($query); } if ($page > 1) { $canonicalParams[] = 'page=' . $page; } $pageCanonical = $canonicalBase; if (!empty($canonicalParams)) { $pageCanonical .= '?' . implode('&', $canonicalParams); } ?> <link rel="canonical" href="<?= htmlspecialchars($pageCanonical, ENT_QUOTES, 'UTF-8') ?>" /> <main class="container my-5"> <div class="row"> <div class="col-md-8 offset-md-2"> <h1 class="display-4 text-center mb-4">Search Results</h1> <p>Discover actionable insights on YouTube thumbnail optimization, trending designs, and video SEO strategies. Search our comprehensive resources covering thumbnail dimensions, CTR improvement techniques, seasonal trends, and YouTube algorithm updates. Find tutorials for our YouTube Thumbnail Grabber tool and professional design tips to enhance your channel's visual appeal.</p> <!-- Search Form --> <form method="GET" action="<?= SITE_URL ?>/pages/search" class="mb-5"> <div class="input-group"> <input type="text" name="q" class="form-control form-control-lg" placeholder="Search blog posts..." value="<?= htmlspecialchars($query) ?>"> <button type="submit" class="btn btn-danger btn-lg">Search</button> </div> </form> <?php if (!empty($query)): ?> <?php // Main search query with all fields $sql = "SELECT id, title, slug, content, tags, meta_title, meta_description, created_at, MATCH(title, content, tags, meta_title, meta_description) AGAINST(? IN BOOLEAN MODE) AS relevance FROM posts WHERE MATCH(title, content, tags, meta_title, meta_description) AGAINST(? IN BOOLEAN MODE) ORDER BY relevance DESC, created_at DESC"; // Get total results $stmt = $db->prepare($sql); $stmt->bind_param('ss', $boolean_query, $boolean_query); $stmt->execute(); $result = $stmt->get_result(); $total_results = $result->num_rows; $total_pages = ceil($total_results / $results_per_page); // Get paginated results $sql .= " LIMIT ? OFFSET ?"; $stmt = $db->prepare($sql); $stmt->bind_param('ssii', $boolean_query, $boolean_query, $results_per_page, $offset); $stmt->execute(); $result = $stmt->get_result(); $results = $result->fetch_all(MYSQLI_ASSOC); ?> <?php if ($total_results > 0): ?> <div class="alert alert-info"> Found <?= number_format($total_results) ?> result<?= $total_results > 1 ? 's' : '' ?> for "<strong><?= htmlspecialchars($query) ?></strong>" </div> <?php foreach ($results as $post): ?> <div class="card mb-4"> <div class="card-body"> <h3 class="card-title"> <a href="<?= SITE_URL ?>/pages/blog?q=<?= $post['id'] ?>/<?= $post['slug'] ?>"> <?= htmlspecialchars($post['title']) ?> </a> </h3> <p class="text-muted small"> <?= date('F j, Y', strtotime($post['created_at'])) ?> • Relevance: <?= number_format($post['relevance'], 2) ?> </p> <div class="meta mb-3"> <?php if (!empty($post['tags'])): ?> <div class="tags"> <i class="fas fa-tags"></i> <?= htmlspecialchars($post['tags']) ?> </div> <?php endif; ?> </div> <div class="excerpt"> <?= highlight_search_terms( $post['content'] . ' ' . $post['tags'] . ' ' . $post['meta_title'] . ' ' . $post['meta_description'], $search_terms ) ?> </div> </div> </div> <?php endforeach; ?> <!-- Pagination --> <?php if ($total_pages > 1): ?> <nav aria-label="Search results pages"> <ul class="pagination justify-content-center"> <?php for ($i = 1; $i <= $total_pages; $i++): ?> <li class="page-item <?= $i == $page ? 'active' : '' ?>"> <a class="page-link" href="<?= SITE_URL ?>/pages/search?q=<?= urlencode($query) ?>&page=<?= $i ?>"> <?= $i ?> </a> </li> <?php endfor; ?> </ul> </nav> <?php endif; ?> <?php else: ?> <div class="alert alert-warning"> No results found for "<strong><?= htmlspecialchars($query) ?></strong>" </div> <?php endif; ?> <?php else: ?> <div class="alert alert-info"> Please enter a search term to find blog posts </div> <?php endif; ?> </div> </div> </main> <?php include '../includes/footer.php'; ?> <?php function highlight_search_terms($content, $terms) { $excerpt_length = 200; $content = strip_tags($content); // Find best excerpt position $positions = []; foreach ($terms as $term) { $pos = stripos($content, $term); if ($pos !== false) { $positions[] = $pos; } } sort($positions); $start = $positions ? max(0, $positions[0] - 50) : 0; $excerpt = substr($content, $start, $excerpt_length); // Highlight terms foreach ($terms as $term) { $excerpt = preg_replace( "/\b(" . preg_quote($term, '/') . ")\b/i", '<mark class="bg-warning text-dark rounded px-1">\1</mark>', $excerpt ); } return $excerpt . (strlen($content) > $excerpt_length ? '...' : ''); } ?>
Save