⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.124
Server IP:
50.28.103.30
Server:
Linux host.jcukjv-lwsites.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
Server Software:
nginx/1.28.0
PHP Version:
8.3.12
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
www
/
wwwroot
/
china-democracyparty.com
/
5
/
View File Name :
index.php
<?php require_once __DIR__ . '/sql.php'; // 1. 获取搜索关键字(用 GET) $q = isset($_GET['q']) ? trim($_GET['q']) : ''; // 2. 根据是否有搜索词,准备不同 SQL if ($q !== '') { // 有搜索:用 LIKE 模糊匹配标题、描述、内容 $sql = "SELECT * FROM blogs WHERE title LIKE ? OR description LIKE ? OR content LIKE ? ORDER BY id DESC"; $stmt = $conn->prepare($sql); $like = '%' . $q . '%'; $stmt->bind_param("sss", $like, $like, $like); $stmt->execute(); $result = $stmt->get_result(); } else { // 无搜索:全部文章 $sql = "SELECT * FROM blogs ORDER BY id DESC"; $result = $conn->query($sql); } ?> <!DOCTYPE html> <html lang="en"> <?php include __DIR__ . '/view/head.php'; ?> <style> .zh{ font-family: 'Zhi Mang Xing', cursive; } </style> <body> <?php include __DIR__ . '/view/header.php'; ?> <div class="main-wrapper"> <section class="cta-section theme-bg-light py-5"> <div class="container text-center"> <h2 class="heading zh">权力与恐惧:中共统治逻辑解析</h2> <div class="intro zh">从政治暴力到意识形态操控的全面记录.</div> <!-- 搜索表单(GET 提交到当前页) --> <form class="signup-form form-inline justify-content-center pt-3" method="get" action=""> <div class="form-group"> <label class="sr-only" for="search">输入. . .</label> <input type="text" id="search" name="q" class="form-control mr-md-1 semail zh" placeholder="输入关键词,例如:文革、镇压、宣传" value="<?= htmlspecialchars($q, ENT_QUOTES) ?>" > </div> <button type="submit" class="btn btn-primary zh">搜索</button> </form> <?php if ($q !== ''): ?> <div class="mt-3 zh"> 当前搜索:<strong><?= htmlspecialchars($q, ENT_QUOTES) ?></strong> </div> <?php endif; ?> </div><!--//container--> </section> <section class="blog-list px-3 py-5 p-md-5"> <div class="container"> <?php if ($result && $result->num_rows > 0): ?> <?php while ($row = $result->fetch_assoc()): ?> <div class="item mb-5"> <div class="media"> <!-- 封面图:如果数据库为空就用默认图 --> <img class="mr-3 img-fluid post-thumb d-none d-md-flex" src="<?= htmlspecialchars($row['image'] ?: 'assets/images/blog/blog-post-thumb-1.jpg') ?>" alt="image"> <div class="media-body"> <!-- 标题 --> <h3 class="title mb-1 zh"> <a href="blog-post.php?id=<?= (int)$row['id'] ?>"> <?= htmlspecialchars($row['title']) ?> </a> </h3> <!-- 日期 + 浏览 --> <div class="meta mb-1"> <span class="date zh"> <?= date('Y-m-d', strtotime($row['created_at'])) ?> </span> <span class="comment zh"> <a>浏览 <?= (int)$row['views'] ?></a> </span> </div> <!-- 描述 --> <div class="intro zh"> <?= htmlspecialchars($row['description']) ?> </div> <a class="more-link zh" href="blog-post.php?id=<?= (int)$row['id'] ?>"> 浏览 → </a> </div><!--//media-body--> </div><!--//media--> </div><!--//item--> <?php endwhile; ?> <?php else: ?> <div class="alert alert-secondary zh"> <?php if ($q !== ''): ?> 没有找到与 “<?= htmlspecialchars($q, ENT_QUOTES) ?>” 相关的文章。 <?php else: ?> 暂无文章。 <?php endif; ?> </div> <?php endif; ?> <nav class="blog-nav nav nav-justified my-5"> <a class="nav-link-prev nav-item nav-link d-none rounded-left" href="#">Previous<i class="arrow-prev fas fa-long-arrow-alt-left"></i></a> <a class="nav-link-next nav-item nav-link rounded" href="#">Next<i class="arrow-next fas fa-long-arrow-alt-right"></i></a> </nav> </div> </section> <footer class="footer text-center py-2 theme-bg-dark"> <small class="copyright"> Copyright © 2019.ylfreedom All rights reserved. </small> </footer> </div><!--//main-wrapper--> <!-- Javascript --> <script src="assets/plugins/jquery-3.3.1.min.js"></script> <script src="assets/plugins/popper.min.js"></script> <script src="assets/plugins/bootstrap/js/bootstrap.min.js"></script> <script src="assets/js/demo/style-switcher.js"></script> </body> </html>