/
/
home
/
u523034047
/
domains
/
cbtfx.org
/
public_html
Server: in-mum-web1112.main-hosting.eu (62.72.28.111)
You: 216.73.216.52
PHP 8.3.16
Dir:
/home/u523034047/domains/cbtfx.org/public_html
Edit:
/home/u523034047/domains/cbtfx.org/public_html/index.php
<?php include 'wa-link2.php'; ?> <?php require_once __DIR__ . '/admin/conn.php'; /* ===== EMPTY SEARCH REDIRECT ===== */ if (isset($_GET['q']) && trim($_GET['q']) === '') { header("Location: blog.php"); exit; } // 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> <?php if($q !== ''){ echo "Search results for '".htmlspecialchars($q)."' – CBTF Blog"; } else { echo "CBTF Blog – India’s Most Trusted Gaming Platform"; } ?> </title> <?php if($q !== ''): ?> <meta name="description" content="Search results for <?php echo htmlspecialchars($q); ?> on CBTF Blog. Latest gaming, cricket prediction and platform updates."> <?php else: ?> <meta name="description" content="Read latest blogs on CBTF – India’s most trusted gaming platform. Cricket predictions, tips, updates and insights."> <?php endif; ?> <?php if($q !== ''): ?> <meta name="robots" content="noindex, follow"> <?php endif; ?> <link rel="canonical" href="https://cbtf.org/blog/"> <style> :root{ --primary:#7b2ff7; --secondary:#c94bff; --dark:#0b0c14; --card:#111425; --border:#2a2f4a; --text:#e8e9f0; --muted:#9aa4b2; } body{ font-family:'Segoe UI',Arial,Helvetica,sans-serif; background:linear-gradient(180deg,#0b0c14,#0e1020); color:var(--text); margin:0; } /* CONTAINER */ .container{ max-width:1050px; margin:40px auto; padding:0 16px; } /* HEADER */ .header{ display:flex; justify-content:space-between; align-items:center; margin-bottom:26px; gap:15px; } .header h1{ display:flex; align-items:center; gap:12px; font-size:22px; } .header img{ height:48px; } /* SEARCH */ input[type="search"]{ padding:10px 14px; border-radius:30px; border:1px solid var(--border); background:#0f1226; color:#fff; outline:none; } input[type="search"]:focus{ border-color:var(--primary); box-shadow:0 0 0 2px rgba(123,47,247,.3); } /* POST CARD */ .post{ background:linear-gradient(145deg,#121636,#0e1128); padding:18px; border-radius:16px; margin-bottom:18px; display:flex; gap:16px; border:1px solid var(--border); transition:.35s ease; } .post:hover{ transform:translateY(-6px); box-shadow:0 20px 40px rgba(123,47,247,.25); border-color:var(--primary); } /* IMAGE */ .thumb{ width:150px; height:95px; flex:0 0 150px; border-radius:10px; object-fit:cover; background:#1a1f3d; } /* TITLE */ .title{ text-decoration:none; } .title h2{ color:#fff; font-size:18px; } .post:hover .title h2{ background:linear-gradient(135deg,var(--primary),var(--secondary)); -webkit-background-clip:text; -webkit-text-fill-color:transparent; } /* META */ .meta{ color:var(--muted); font-size:13px; margin-top:4px; } /* SUMMARY */ .post p{ margin-top:10px; color:#cfd6dc; line-height:1.6; } /* PAGINATION */ .pager{ display:flex; justify-content:center; align-items:center; gap:12px; margin:30px 0; } .page-link{ padding:10px 16px; background:linear-gradient(135deg,#14184a,#0e1130); border-radius:30px; color:#fff; text-decoration:none; border:1px solid var(--border); transition:.3s; } .page-link:hover{ background:linear-gradient(135deg,var(--primary),var(--secondary)); box-shadow:0 10px 25px rgba(123,47,247,.4); } /* MOBILE */ @media(max-width:768px){ .post{ flex-direction:column; } .thumb{ width:100%; height:180px; } } .search-btn{ padding:10px 18px; border-radius:30px; border:1px solid var(--border); background:linear-gradient(135deg,var(--primary),var(--secondary)); color:#fff; cursor:pointer; font-weight:500; transition:.3s ease; } .search-btn:hover{ box-shadow:0 10px 25px rgba(123,47,247,.45); transform:translateY(-2px); } </style> </head> <body> <div class="container"> <div class="header"> <h1> <a href="index.php"><img fetchpriority="high" width="" height="50" src="../img/cbtf_com-logo.png" class="attachment-full size-full wp-image-634" alt="cbtf Gaming Logo" sizes="(max-width: 100px) 100vw, 100px" /></a> </h1> <form method="get" action="" style="display:flex; gap:8px;"> <input type="search" name="q" placeholder="Search articles..." value="<?php echo htmlspecialchars($q); ?>"> <button type="submit" class="search-btn">Search</button> </form> </div> <?php if(empty($posts)): ?> <p style="color:#9aa4b2"> 😕 “<?php echo htmlspecialchars($q); ?>” ke liye koi article nahi mila. Popular posts ya latest updates check karein. </p> <?php else: foreach($posts as $p): ?> <article class="post"> <?php if($p['featured_image']): ?> <img class="thumb" loading="lazy" src="../admin/uploads/<?php echo htmlspecialchars($p['featured_image']); ?>" alt="<?php echo htmlspecialchars($p['title']); ?> - CBTF Blog"> <?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: 8.5 KB