28 lines
624 B
PHP
28 lines
624 B
PHP
<?php
|
|
require_once 'auth.php';
|
|
require_once '../includes/db.php';
|
|
|
|
$id = $_GET['id'] ?? 0;
|
|
|
|
if ($id > 0) {
|
|
// 获取应用信息
|
|
$stmt = $db->prepare("SELECT * FROM apps WHERE id = ?");
|
|
$stmt->execute([$id]);
|
|
$app = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
|
|
if ($app) {
|
|
// 删除物理文件
|
|
$file_path = '../data/apps/' . $app['filename'];
|
|
if (file_exists($file_path)) {
|
|
unlink($file_path);
|
|
}
|
|
|
|
// 从数据库删除
|
|
$stmt = $db->prepare("DELETE FROM apps WHERE id = ?");
|
|
$stmt->execute([$id]);
|
|
}
|
|
}
|
|
|
|
header('Location: dashboard.php');
|
|
exit;
|