forked from delpino73/Blue-Smiley-Organizer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
delete-file.php
30 lines (16 loc) · 873 Bytes
/
delete-file.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
<?php
require 'class.base.php';
$base_instance=new base();
$userid=$base_instance->get_userid();
$item=isset($_REQUEST['item']) ? (int)$_REQUEST['item'] : exit;
if ($item) {
$data=$base_instance->get_data("SELECT * FROM {$base_instance->entity['FILE']['MAIN']} WHERE user='$userid' AND ID='$item'");
if (!$data) { echo 'item',$item,'|<table cellspacing=0 cellpadding=4 class="pastel" bgcolor="#ffffff"><tr><td><strong>File not found</strong></td></tr></table>'; exit; }
$filename=$data[1]->filename;
$base_instance->query("DELETE FROM {$base_instance->entity['FILE']['MAIN']} WHERE ID='$item' AND user='$userid'");
if (file_exists('./upload/'.$userid.'/'.$filename)) {
unlink('./upload/'.$userid.'/'.$filename);
}
echo 'item',$item,'|<table cellspacing=0 cellpadding=4 class="pastel" bgcolor="#ffffff"><tr><td><strong>Deleted</strong></td></tr></table>';
}
?>