-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete.php
47 lines (37 loc) · 1.13 KB
/
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
if(isset($_GET['delete'])){
if($_GET['delete'] == "1"){
if(isset($_GET['note']) && isset($_GET['dir'])){
$dir = $_GET['dir'];
$note = $_GET['note'];
try{
$file = "archivos/" . $dir . '/' . $note;
if(unlink($file)){
header('Location: directorio.php?dir=' . $dir);
}else{
header('Location: nuevo.php');
}
}catch (Exception $e){
echo 'Excepción capturada: ', $e->getMessage(), "\n\n";
}
}else{
header('Location: directorio.php');
}
}else if($_GET['delete'] == "2"){
if(isset($_GET['dir'])){
$dir = $_GET['dir'];
try{
$file = "archivos/" . $dir;
rmdir($file);
header('Location: abrir.php');
}catch (Exception $e){
echo 'Excepción capturada: ', $e->getMessage(), "\n\n";
}
}else{
header('Location: nuevo.php');
}
}
}else{
header('Location: nuevo.php');
}
?>