diff options
author | Alex AUVOLAT <alexis211@gmail.com> | 2012-06-21 16:34:27 +0200 |
---|---|---|
committer | Alex AUVOLAT <alexis211@gmail.com> | 2012-06-21 16:34:27 +0200 |
commit | 889e8eaf7c40817663dd602a21ac771062ccac3b (patch) | |
tree | ca8ac81ee202165333e5ffe16147d09e5cdaf2ab /lib/file/delete.php | |
parent | 5c4caed8560d5fded00525844dfa8386b97e7918 (diff) | |
download | Bits-889e8eaf7c40817663dd602a21ac771062ccac3b.tar.gz Bits-889e8eaf7c40817663dd602a21ac771062ccac3b.zip |
Big change, sir. Can now upload any kind of files.
Diffstat (limited to 'lib/file/delete.php')
-rw-r--r-- | lib/file/delete.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/file/delete.php b/lib/file/delete.php new file mode 100644 index 0000000..1a65058 --- /dev/null +++ b/lib/file/delete.php @@ -0,0 +1,21 @@ +<?php + +require("lib/conf/file.php"); + +$title = "Delete a file"; + +if (count($args) < 3) header("location: index.php"); +$id = intval($args[2]); + +$info = mysql_fetch_assoc(sql("SELECT * FROM files WHERE id = $id")); + +if ($info["owner"] == $user["id"]) { + token_validate("Do you really want to delete this file ?", "file"); + if (has_mini($info["extension"])) unlink($savedir . $id . "-min." . $info["extension"]); + unlink($savedir . $id . "." . $info["extension"]); + sql("DELETE FROM files WHERE id = $id"); + header("location: file"); +} else { + $error = "You cannot delete this file."; +} +require("tpl/general/empty.php"); |