Browse Source

Remove files

pull/40/head
Savetheinternet 14 years ago
parent
commit
583a6a58d9
  1. 12
      inc/mod.php

12
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)

Loading…
Cancel
Save