summaryrefslogtreecommitdiff
path: root/post.php
diff options
context:
space:
mode:
authorSavetheinternet <savetheinternet@n0v4.com>2010-11-30 23:17:26 +1100
committerSavetheinternet <savetheinternet@n0v4.com>2010-11-30 23:17:26 +1100
commitaefa20a3a4d28b0f0c284722dbc4d0eb144358b7 (patch)
tree5f6218d7b875f351a5b0ef399f90ad7627a54b65 /post.php
parent210563045dabebec3ef8a4f1c3823293659fdc8d (diff)
Get board information earlier so errors can be properly displayed with a link back to the index.
Diffstat (limited to 'post.php')
-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]:'');