diff options
| author | Savetheinternet <savetheinternet@n0v4.com> | 2011-01-01 21:44:11 +1100 |
|---|---|---|
| committer | Savetheinternet <savetheinternet@n0v4.com> | 2011-01-01 21:44:11 +1100 |
| commit | 583a6a58d99504177b3c27e698a9644bdba0cf9d (patch) | |
| tree | 2631986cd4b9166b9001d38964e62a6051ef8176 /inc/mod.php | |
| parent | 1fa0f64038d74cbcfba35d79e6bc0d2ea8146359 (diff) | |
Remove files
Diffstat (limited to 'inc/mod.php')
| -rw-r--r-- | inc/mod.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/inc/mod.php b/inc/mod.php index dd16a1a6..a2ee93ce 100644 --- a/inc/mod.php +++ b/inc/mod.php @@ -143,13 +143,23 @@ function deleteFile($id) { global $board; - $query = prepare(sprintf("SELECT `thread`,`thumb`,`file` FROM `posts_%s` WHERE `id` = :id AND `thread` IS NOT NULL", $board['uri'])); + $query = prepare(sprintf("SELECT `thread`,`thumb`,`file` FROM `posts_%s` WHERE `id` = :id AND `thread` IS NOT NULL LIMIT 1", $board['uri'])); $query->bindValue(':id', $id, PDO::PARAM_INT); $query->execute() or error(db_error($query)); if($query->rowCount() < 1) { error(ERROR_INVALIDPOST); } + + $post = $query->fetch(); + + // Delete thumbnail + @unlink($board['dir'] . DIR_THUMB . $post['thumb']); + + // Delete file + @unlink($board['dir'] . DIR_IMG . $post['file']); + + } // Delete a post (reply or thread) |
