-
Notifications
You must be signed in to change notification settings - Fork 3
/
resource_remove.php
executable file
·40 lines (40 loc) · 1.1 KB
/
resource_remove.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
include_once("include_fns.php");
session_start();
$page=safeGet('page');
if(!isset($_SESSION['email'])){
middlepage("index.php", "请先登录");
}
$classid = -1;
if (isset($_SESSION['classid'])) {
$classid = $_SESSION['classid'];
}
if (isset($_GET['classid'])){
$classid = safeGet('classid');
$_SESSION['classid'] = $classid;
}
if($classid == -1){
middlepage("classes.php", "请先选择班级");
}
$email = $_SESSION['email'];
$admin = get_authority($classid,$email);
if ($admin == -1) {
unset($_SESSION['classid']);
middlepage("classes.php", "你不是本班成员");
}
if ($admin > 1) {
middlepage("main.php?page".$page,"权限不足");
}
if (!isset($_GET['category']) || !isset($_GET['name'])) {
middlepage("main.php?page".$page, "你穿越了吧?");
} else {
$category = safeGet('category');
$filename = safeGet('name');
$ext = "./upload/$classid/$category/$filename";
if (file_exists($ext)) {
unlink ($ext);
}
delete_resource($classid,$category,$filename);
middlepage("main.php?page".$page, "删除成功!");
}
?>