PHP: Getting an unexpected T_VARIABLE error but can't see it

Associate
Joined
12 Dec 2010
Posts
1,428
if (isset ($_POST['post'])) {

if($_DATA['user']['user_level'] >= 45)
$message_text = str_replace('[dice]',$_DATA['user']['user_name'].' rolled two six-sided dice: ['.rand(1,6).']['.rand(1,6).']',$message_text);

$insert_cmds = array(
'message_poster' => $_DATA['user']['user_id'],
'message_time' => time(),
'message_text' => $message_text,
'message_topicid' => $topicid,
'message_ip' => $_DATA['ip']['address'],
'message_boardid' => $board_info['board_id']
);

$SQL->insert('messages', $insert_cmds);
$msgid = $SQL->insert_id();


/* Attachments */
if (isset($_FILES['upload']['name']) $_FILES['upload']['size'] > 0 && $_DATA['user']['user_level'] >= $_CONF['abilities']['attachment']) {
if ($_FILES['upload']['size'] > $_CONF['general']['attach_limit'])
$page->error('other', 'The attachment exceeded the upload limit!');
$update_cmds = array(
'message_aname' => $_FILES['upload']['name'],
'message_amime' => $_FILES['upload']['type'],
'message_asize' => $_FILES['upload']['size']
);

if(!move_uploaded_file($_FILES['upload']['tmp_name'], 'attachments/'.$msgid))
$page->error('other', 'An unknown error occured while uploading the attachment.');

$SQL->update('messages', $update_cmds, '`message_id` = '.$msgid);
}

if ($_DATA['user']['user_level'] >= $_CONF['perms']['moderator'] && isset($_POST['sticky']))
$SQL->query('UPDATE `topics` SET `topic_sticky` = 1 WHERE `topic_id` = '.$topicid);
else if ($_DATA['user']['user_level'] >= $_CONF['perms']['moderator'] && isset($_POST['close']))
$SQL->query('UPDATE `topics` SET `topic_status` = 1 WHERE `topic_id` = '.$topicid);

rebuild_topic_cache($topicid);

$msgs = $SQL->fetch_row($SQL->query('SELECT `topic_msgcount` FROM `topics` WHERE `topic_id` = '.$topicid));

$page = ceil($msgs[0]/$_CONF['display']['default_ipp']);
if ($_DATA['user']['user_invertmsg'] == 0)
header('Location: genmessage.php?topic='.$topicid.'&page='.$page.'#msg'.$msgid);
else
header('Location: genmessage.php?topic='.$topicid.'&page='.$page.'#msg'.$msgid);

$page->footer();
}

On line 142, which is the line with the attachments comment on it. Can anyone see what's wrong?
 
Last edited:
After posting this topic i realised there was no logic condition between the both and added a "&&" between them. It seems to be working now. Thanks all the same guys.
 
Back
Top Bottom