summaryrefslogtreecommitdiff
path: root/post.php
diff options
context:
space:
mode:
authorMichael Foster <savetheinternet@tinyboard.org>2013-07-31 20:51:43 -0400
committerMichael Foster <savetheinternet@tinyboard.org>2013-07-31 20:51:43 -0400
commit328484bee7cab9ce354121413cc8d96c3e227aea (patch)
tree7adf01c48cbe1970c159da182292b5c7ed48d958 /post.php
parent6bbe407e18681f2812db4345036bb5ae639f5973 (diff)
SQL cleanup
Diffstat (limited to 'post.php')
-rw-r--r--post.php10
1 files changed, 5 insertions, 5 deletions
diff --git a/post.php b/post.php
index db077866..f4499845 100644
--- a/post.php
+++ b/post.php
@@ -52,7 +52,7 @@ if (isset($_POST['delete'])) {
$query->bindValue(':id', $id, PDO::PARAM_INT);
$query->execute() or error(db_error($query));
- if ($post = $query->fetch()) {
+ if ($post = $query->fetch(PDO::FETCH_ASSOC)) {
if ($password != '' && $post['password'] != $password)
error($config['error']['invalidpassword']);
@@ -115,12 +115,12 @@ if (isset($_POST['delete'])) {
$query->bindValue(':id', $id, PDO::PARAM_INT);
$query->execute() or error(db_error($query));
- $post = $query->fetch();
+ $thread = $query->fetchColumn();
- if ($post) {
+ if ($thread) {
if ($config['syslog'])
_syslog(LOG_INFO, 'Reported post: ' .
- '/' . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], $post['thread'] ? $post['thread'] : $id) . ($post['thread'] ? '#' . $id : '') .
+ '/' . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], $thread ? $thread : $id) . ($thread ? '#' . $id : '') .
' for "' . $reason . '"'
);
$query = prepare("INSERT INTO `reports` VALUES (NULL, :time, :ip, :board, :post, :reason)");
@@ -231,7 +231,7 @@ if (isset($_POST['delete'])) {
$query->bindValue(':id', $post['thread'], PDO::PARAM_INT);
$query->execute() or error(db_error());
- if (!$thread = $query->fetch()) {
+ if (!$thread = $query->fetch(PDO::FETCH_ASSOC)) {
// Non-existant
error($config['error']['nonexistant']);
}