Files
leonapp/admin/deleteapp.php
Your Name accf0760bb feat: 实现完整的应用商店系统
- 添加前端页面包括首页、应用详情页和版本历史页
- 实现管理员后台功能,包括应用管理、版本管理和登录验证
- 添加API接口用于获取应用列表和详情
- 实现文件上传和下载功能
- 添加Windows控制台和GUI客户端
- 完善数据库结构和初始化脚本
- 添加样式表和图片资源
2025-07-06 19:46:42 +08:00

41 lines
1.0 KiB
PHP

<?php
require_once '../config.php';
session_start();
// 检查管理员登录状态
if (!isset($_SESSION['admin'])) {
header('Location: login.php');
exit;
}
// 验证App ID
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
header('Location: index.php?error=无效的App ID');
exit;
}
$appId = $_GET['id'];
// 删除App
$deleteAppSql = "DELETE FROM apps WHERE id = ?";
$stmt = $conn->prepare($deleteAppSql);
$stmt->bind_param("i", $appId);
if ($stmt->execute() === TRUE) {
// 删除关联的图片
$deleteImagesSql = "DELETE FROM app_images WHERE app_id = ?";
$imgStmt = $conn->prepare($deleteImagesSql);
$imgStmt->bind_param("i", $appId);
$imgStmt->execute();
// 删除关联的版本
$deleteVersionsSql = "DELETE FROM app_versions WHERE app_id = ?";
$verStmt = $conn->prepare($deleteVersionsSql);
$verStmt->bind_param("i", $appId);
$verStmt->execute();
header('Location: index.php?success=App 删除成功');
} else {
header('Location: index.php?error=App 删除失败: '. $conn->error);
}
exit;
?>