summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--post.php19
1 files changed, 12 insertions, 7 deletions
diff --git a/post.php b/post.php
index bdc4819f..cadee9ed 100644
--- a/post.php
+++ b/post.php
@@ -30,7 +30,7 @@
!isset($_POST['password'])
) error(ERROR_BOT);
- $post = Array();
+ $post = Array('board' => $_POST['board']);
if(isset($_POST['thread'])) {
$OP = false;
@@ -57,6 +57,17 @@
if(time()-$user['appeared']<LURKTIME) error(ERROR_LURK);
*/
+ // Open database connection
+ sql_open();
+
+ // Check if board exists
+ if(!openBoard($post['board']))
+ error(ERROR_NOBOARD);
+
+ //Check if thread exists
+ if(!$OP && !threadExists($post['thread']))
+ error(ERROR_NONEXISTANT);
+
// Check for a file
if($OP) {
if(!isset($_FILES['file']['tmp_name']) || empty($_FILES['file']['tmp_name']))
@@ -70,7 +81,6 @@
$post['password'] = $_POST['password'];
$post['filename'] = $_FILES['file']['name'];
$post['has_file'] = $OP || !empty($_FILES['file']['tmp_name']);
- $post['board'] = $_POST['board'];
if($post['has_file']) {
$size = $_FILES['file']['size'];
@@ -81,11 +91,6 @@
'maxsz'=>commaize(MAX_FILESIZE))));
}
- sql_open();
- if(!openBoard($post['board'])) error(ERROR_NOBOARD);
- if(!$OP && !threadExists($post['thread']))
- error(ERROR_NONEXISTANT);
-
$trip = generate_tripcode($post['name']);
$post['name'] = $trip[0];
$post['trip'] = (isset($trip[1])?$trip[1]:'');