/
/
home
/
u523034047
/
domains
/
badshacric.com
/
public_html
/
blog
Server: in-mum-web1112.main-hosting.eu (62.72.28.111)
You: 216.73.216.52
PHP 8.3.16
Dir:
/home/u523034047/domains/badshacric.com/public_html/blog
Edit:
/home/u523034047/domains/badshacric.com/public_html/blog/index.php
<?php include '../wa-link2.php'; ?> <?php require_once __DIR__ . '/../admin/conn.php'; // Params $page = isset($_GET['page']) ? max(1, (int)$_GET['page']) : 1; $perPage = 6; $offset = ($page - 1) * $perPage; $q = isset($_GET['q']) ? trim($_GET['q']) : ''; // Prepare WHERE clause $where = "WHERE status = 'published'"; if ($q !== '') { $search = "%{$q}%"; $where .= " AND (title LIKE ? OR summary LIKE ? OR tags LIKE ?)"; } // -------- COUNT TOTAL POSTS ---------- if ($q !== '') { $stmt = $conn->prepare("SELECT COUNT(*) FROM posts $where"); $stmt->bind_param("sss", $search, $search, $search); } else { $stmt = $conn->prepare("SELECT COUNT(*) FROM posts $where"); } $stmt->execute(); $stmt->bind_result($total); $stmt->fetch(); $stmt->close(); $pages = max(1, ceil($total / $perPage)); // -------- FETCH POSTS ---------- if ($q !== '') { $stmt = $conn->prepare("SELECT id, title, slug, summary, author, featured_image, created_at FROM posts $where ORDER BY created_at DESC LIMIT ?, ?"); $stmt->bind_param("sssii", $search, $search, $search, $offset, $perPage); } else { $stmt = $conn->prepare("SELECT id, title, slug, summary, author, featured_image, created_at FROM posts $where ORDER BY created_at DESC LIMIT ?, ?"); $stmt->bind_param("ii", $offset, $perPage); } $stmt->execute(); $result = $stmt->get_result(); $posts = $result->fetch_all(MYSQLI_ASSOC); $stmt->close(); ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>Blog - badshacric</title> <style> /* Minimal CSS */ body{font-family:Arial,Helvetica,sans-serif;background:#0b0c10;color:#eee;margin:0;padding:0} .container{max-width:1000px;margin:30px auto;padding:0 16px} .header{display:flex;justify-content:space-between;align-items:center;margin-bottom:18px} input[type="search"]{padding:8px;border-radius:6px;border:1px solid #333;background:#0f1418;color:#fff} .post{background:#111318;padding:16px;border-radius:10px;margin-bottom:12px;display:flex;gap:12px} .thumb{width:140px;height:90px;flex:0 0 140px;background:#222;border-radius:6px;object-fit:cover} .meta{color:#9aa4b2;font-size:13px} .title{color:#ff8c00;margin:0 0 6px} .pager{display:flex;gap:8px;margin-top:18px} .page-link{padding:8px 12px;background:#0f1418;border-radius:6px;color:#ddd;text-decoration:none} </style> </head> <body> <div class="container"> <div class="header"> <h1> <a href="index.php"><img fetchpriority="high" width="" height="50" src="../badshah.webp" class="attachment-full size-full wp-image-634" alt="Badshah Gaming Logo" sizes="(max-width: 100px) 100vw, 100px" /></a> Blog </h1> <form method="get" action=""> <input type="search" name="q" placeholder="Search articles..." value="<?php echo htmlspecialchars($q); ?>"> <button type="submit" style="display:none">Go</button> </form> </div> <?php if(empty($posts)): ?> <p>No posts found.</p> <?php else: foreach($posts as $p): ?> <article class="post"> <?php if($p['featured_image']): ?> <img class="thumb" src="../admin/uploads/<?php echo htmlspecialchars($p['featured_image']); ?>" alt="<?php echo htmlspecialchars($p['title']); ?>"> <?php else: ?> <div class="thumb"></div> <?php endif; ?> <div> <a class="title" href="/blog/post.php?slug=<?php echo urlencode($p['slug']); ?>"><h2 style="margin:0"><?php echo htmlspecialchars($p['title']); ?></h2></a> <div class="meta">By <?php echo htmlspecialchars($p['author']); ?> • <?php echo date('M d, Y', strtotime($p['created_at'])); ?></div> <p style="margin-top:8px;color:#cfd6dc"><?php echo htmlspecialchars(mb_strimwidth(strip_tags($p['summary'] ?: $p['content'] ?? ''), 0, 160, '...')); ?></p> </div> </article> <?php endforeach; endif; ?> <!-- Pagination --> <div class="pager"> <?php if($page>1): ?> <a class="page-link" href="?<?php echo http_build_query(array_merge($_GET, ['page'=>$page-1])); ?>">« Prev</a> <?php endif; ?> <div style="align-self:center;color:#9aa4b2">Page <?php echo $page; ?> of <?php echo $pages; ?></div> <?php if($page<$pages): ?> <a class="page-link" href="?<?php echo http_build_query(array_merge($_GET, ['page'=>$page+1])); ?>">Next »</a> <?php endif; ?> </div> </div> <a href="<?php echo $wa_url; ?>" class="floating-whatsapp" target="_blank"> <img src="https://cdn-icons-png.flaticon.com/512/3536/3536445.png" alt="WhatsApp"> </a> <style> .floating-whatsapp { position: fixed; bottom: 20px; right: 20px; background: #25D366; width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(0,0,0,0.3); z-index: 9999; transition: 0.3s; } .floating-whatsapp img { width: 32px; height: 32px; } .floating-whatsapp:hover { transform: scale(1.12); background: #1fa857; } @keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } } .floating-whatsapp { animation: bounce 2s infinite; } </style> </body> </html>
Ukuran: 5.2 KB