Bug fix. Multiple boards now work.

This commit is contained in:
Savetheinternet 2010-11-30 20:44:53 +11:00 committed by Paul Merrill
parent 09880ef231
commit 8809b2e50e
2 changed files with 3 additions and 1 deletions

View File

@ -43,6 +43,7 @@
} }
function openBoard($uri) { function openBoard($uri) {
global $sql;
$boards_res = mysql_query(sprintf("SELECT * FROM `boards` WHERE `uri` = '%s' LIMIT 1", mysql_real_escape_string($uri)), $sql) or error(mysql_error($sql)); $boards_res = mysql_query(sprintf("SELECT * FROM `boards` WHERE `uri` = '%s' LIMIT 1", mysql_real_escape_string($uri)), $sql) or error(mysql_error($sql));
if($_board = mysql_fetch_array($boards_res)) { if($_board = mysql_fetch_array($boards_res)) {
setupBoard($_board); setupBoard($_board);

View File

@ -70,6 +70,7 @@
$post['password'] = $_POST['password']; $post['password'] = $_POST['password'];
$post['filename'] = $_FILES['file']['name']; $post['filename'] = $_FILES['file']['name'];
$post['has_file'] = $OP || !empty($_FILES['file']['tmp_name']); $post['has_file'] = $OP || !empty($_FILES['file']['tmp_name']);
$post['board'] = $_POST['board'];
if($post['has_file']) { if($post['has_file']) {
$size = $_FILES['file']['size']; $size = $_FILES['file']['size'];
@ -80,6 +81,7 @@
'maxsz'=>commaize(MAX_FILESIZE)))); 'maxsz'=>commaize(MAX_FILESIZE))));
} }
sql_open();
if(!openBoard($post['board'])) error(ERROR_NOBOARD); if(!openBoard($post['board'])) error(ERROR_NOBOARD);
$trip = generate_tripcode($post['name']); $trip = generate_tripcode($post['name']);
@ -185,7 +187,6 @@
// Todo: Validate some more, remove messy code, allow more specific configuration // Todo: Validate some more, remove messy code, allow more specific configuration
// MySQLify // MySQLify
sql_open();
mysql_safe_array($post); mysql_safe_array($post);
$id = post($post, $OP); $id = post($post, $OP);