init
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
require_once 'auth.php';
|
||||
require_once '../includes/db.php';
|
||||
require_once '../includes/functions.php';
|
||||
|
||||
// 获取所有应用列表
|
||||
$stmt = $db->query("SELECT * FROM apps ORDER BY upload_time DESC");
|
||||
$apps = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>管理面板</title>
|
||||
<link rel="stylesheet" href="../assets/admin.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="admin-container">
|
||||
<header class="admin-header">
|
||||
<h1>管理面板</h1>
|
||||
<div class="header-actions">
|
||||
<span>欢迎,<?php echo e($_SESSION['username']); ?></span>
|
||||
<a href="config.php" class="btn btn-secondary">网站配置</a>
|
||||
<a href="logout.php" class="btn btn-secondary">退出</a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main class="admin-main">
|
||||
<section class="upload-section">
|
||||
<h2>上传新应用</h2>
|
||||
<form action="upload.php" method="POST" enctype="multipart/form-data" class="upload-form">
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label>APK 文件 *</label>
|
||||
<input type="file" name="apk_file" accept=".apk" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>版本号</label>
|
||||
<input type="text" name="version" placeholder="例如:1.0.0">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>版本描述</label>
|
||||
<textarea name="description" rows="3" placeholder="描述此版本的更新内容..."></textarea>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">上传应用</button>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<section class="apps-section">
|
||||
<h2>已发布应用 (<?php echo count($apps); ?>)</h2>
|
||||
|
||||
<?php if (empty($apps)): ?>
|
||||
<p class="empty-state">暂无已发布的应用</p>
|
||||
<?php else: ?>
|
||||
<table class="apps-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>文件名</th>
|
||||
<th>版本</th>
|
||||
<th>描述</th>
|
||||
<th>大小</th>
|
||||
<th>上传时间</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($apps as $app): ?>
|
||||
<tr>
|
||||
<td><?php echo e($app['original_name']); ?></td>
|
||||
<td><?php echo e($app['version'] ?: '-'); ?></td>
|
||||
<td class="description"><?php echo e($app['description'] ?: '-'); ?></td>
|
||||
<td><?php echo formatFileSize($app['file_size']); ?></td>
|
||||
<td><?php echo date('Y-m-d H:i', strtotime($app['upload_time'])); ?></td>
|
||||
<td>
|
||||
<a href="../data/apps/<?php echo e($app['filename']); ?>" class="btn-small btn-info" download>下载</a>
|
||||
<a href="delete.php?id=<?php echo $app['id']; ?>"
|
||||
class="btn-small btn-danger"
|
||||
onclick="return confirm('确定要删除此应用吗?')">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
</main>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user