admin/index.php

(开头部分) 7KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php
require_once __DIR__ . '/../core/Session.php';
require_once __DIR__ . '/../core/Security.php';
require_once __DIR__ . '/../core/Logger.php';
require_once __DIR__ . '/../app/models/Post.php';
require_once __DIR__ . '/../app/models/Comment.php';
require_once __DIR__ . '/../app/models/User.php';

Session::start();
Session::requireLogin();

$user = Session::getUser();
$postModel = new Post();
$commentModel = new Comment();
$userModel = new User();

$totalPosts = $postModel->count("status = 'published'");
$totalDrafts = $postModel->count("status = 'draft'");
$totalComments = $commentModel->count("status = 'approved'");
$pendingComments = $commentModel->count("status = 'pending'");
$totalViews = $postModel->getTotalViews();
$totalUsers = $userModel->count('status = 1');

$recentPosts = $postModel->getRecentPostsAdmin(5);

$recentComments = $commentModel->getRecentComments(5);

$csrfToken = Security::generateCSRFToken();
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>控制面板 - PHP个人博客系统</title>
    <link rel="stylesheet" href="../assets/css/admin.css">
</head>
<body class="admin-page">
    <div class="admin-wrapper">
        <?php include 'views/partials/sidebar.php'; ?>
        
        <div class="admin-content">
            <?php include 'views/partials/header.php'; ?>
            
            <div class="admin-main">
                <div class="page-header">
                    <h1>控制面板</h1>
                    <p>欢迎回来,<?php echo Security::cleanXSS($user['nickname'] ?: $user['username']); ?></p>
                </div>
                
                <div class="dashboard-stats">
                    <div class="stat-card">
                        <div class="stat-icon posts"></div>
                        <div class="stat-info">
                            <span class="stat-number"><?php echo $totalPosts; ?></span>
                            <span class="stat-label">已发布文章</span>
                        </div>
                    </div>
                    
                    <div class="stat-card">
后面还有 103 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。