-
Notifications
You must be signed in to change notification settings - Fork 0
/
delete.php
31 lines (28 loc) · 826 Bytes
/
delete.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
<?php
session_start();
if (isset($_POST['file'])) {
// Check to make sure the token that this user has is
// still the same one we gave them before.
if ($_SESSION['token'] !== $_POST['token']) {
header("Location: ftpgui.php?error=invalid_token");
exit;
}
$filename = $_POST['file'];
// Three different visibilities.
if ($_POST['visibility'] == 'private') {
$full_path = sprintf("../server_data/users/%s", $filename);
}
elseif ($_POST['visibility'] == 'public') {
$full_path = sprintf("../server_data/public/%s", $filename);
}
elseif ($_POST['visibility'] == 'group') {
$full_path = sprintf("../server_data/groups/%s", $filename);
}
if (unlink($full_path) == false) {
header("Location: ftpgui.php?error=nofile");
exit;
}
header("Location: ftpgui.php");
exit;
}
?>