homepage Welcome to WebmasterWorld Guest from 54.167.11.16
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
[Urgent] Parse Error
Shoutbox causing sporadic errors
vigilantweather




msg:1279102
 9:22 pm on Feb 21, 2006 (gmt 0)

Hi, I am new at this whole php & phpbb thing. I have PhpBB 2.x for my board (forums) and last night I tried to install a shoutbox mod...

My admin panel has an error on the left side of it (where the feature list goes)... the error is below:

Parse error: parse error, unexpected T_VARIABLE in /home/vigilant/public_html/board/admin/admin_db_utilities.php on line 702

Here is line 702 in admin/admin_db_utilities.php:

$additional_tables = (isset($HTTP_POST_VARS['additional_tables']))? $HTTP_POST_VARS['additional_tables'] : ( (isset($HTTP_GET_VARS['additional_tables']))? $HTTP_GET_VARS['additional_tables'] : "" );$backup_type = (isset($HTTP_POST_VARS['backup_type']))? $HTTP_POST_VARS['backup_type'] : ( (isset($HTTP_GET_VARS['backup_type']))? $HTTP_GET_VARS['backup_type'] : "" );

Any ideas on how to fix this?

Any help appreciated and needed ASAP!

Thanks.

 

Birdman




msg:1279103
 9:52 pm on Feb 21, 2006 (gmt 0)

It looks to me like you have too many parentheses. I marked them in red. Try removing them.

$additional_tables = (isset($HTTP_POST_VARS['additional_tables']))? $HTTP_POST_VARS['additional_tables'] : ( (isset($HTTP_GET_VARS['additional_tables']))? $HTTP_GET_VARS['additional_tables'] : "" );

$backup_type = (isset($HTTP_POST_VARS['backup_type']))? $HTTP_POST_VARS['backup_type'] : ( (isset($HTTP_GET_VARS['backup_type']))? $HTTP_GET_VARS['backup_type'] : "" );

Birdman




msg:1279104
 10:01 pm on Feb 21, 2006 (gmt 0)

I prefer an approach like below myself. It's easier to understand.

if ( isset($HTTP_POST_VARS['additional_tables']) )
{
$additional_tables = $HTTP_POST_VARS['additional_tables'];
} elseif ( $HTTP_GET_VARS['additional_tables'] ) {
$additional_tables = $HTTP_GET_VARS['additional_tables']
} else {
$additional_tables = '';
}

Also, I found another mistake while reformatting the code. You(or they?) start out using all single quotes to around strings, then switch to doubles at the very end. That could very well be your error.

Notice the doubles below:

$additional_tables = (isset($HTTP_POST_VARS['additional_tables']))? $HTTP_POST_VARS['additional_tables'] : ( (isset($HTTP_GET_VARS['additional_tables']))? $HTTP_GET_VARS['additional_tables'] : "" );$backup_type = (isset($HTTP_POST_VARS['backup_type']))? $HTTP_POST_VARS['backup_type'] : ( (isset($HTTP_GET_VARS['backup_type']))? $HTTP_GET_VARS['backup_type'] : "" );

vigilantweather




msg:1279105
 10:21 pm on Feb 21, 2006 (gmt 0)

When I replaced line 702 with your revised one (top code of your 2nd post or post #3 in here), the error becomes:

Parse error: parse error, unexpected T_IF in /home/vigilant/public_html/board/admin/admin_db_utilities.php on line 702

Should I have not replaced it with that code?

I'm a bit lost!

jatar_k




msg:1279106
 10:28 pm on Feb 21, 2006 (gmt 0)

maybe look at the line above and see if it is missing anything

what happens with some of these parse errors is a mismatch of () or {} or even a missing ; causes the error to be reported farther down in the code.

It's what we call 'trickle down'. It may even have occured much farther up. Do you have a copy of the file before you added the mod? You could compare the 2 and see where the changes are.

vigilantweather




msg:1279107
 10:33 pm on Feb 21, 2006 (gmt 0)

Unfortunately I don't... I'll send lines 696 through 706 of admin/admin_db_utilities.php --- here they are below:

$tables = array(
'auth_access', 'banlist', 'categories', 'config', 'disallow', 'forums', 'forum_prune', 'groups', 'posts', 'posts_text', 'privmsgs', 'privmsgs_text', 'ranks', 'search_results', 'search_wordlist', 'search_wordmatch', 'sessions', 'smilies', 'themes', 'themes_name', 'topics', 'topics_watch', 'user_group', 'users', 'vote_desc', 'vote_results', 'vote_voters', 'words', 'confirm');
// Start add - Fully integrated shoutbox MOD
$tables[] = 'shout'
// End add - Fully integrated shoutbox MOD

$additional_tables = (isset($HTTP_POST_VARS['additional_tables']))? $HTTP_POST_VARS['additional_tables'] : ( (isset($HTTP_GET_VARS['additional_tables']))? $HTTP_GET_VARS['additional_tables'] : "" );$backup_type = (isset($HTTP_POST_VARS['backup_type']))? $HTTP_POST_VARS['backup_type'] : ( (isset($HTTP_GET_VARS['backup_type']))? $HTTP_GET_VARS['backup_type'] : "" );

$gzipcompress = (!empty($HTTP_POST_VARS['gzipcompress']))? $HTTP_POST_VARS['gzipcompress'] : ( (!empty($HTTP_GET_VARS['gzipcompress']))? $HTTP_GET_VARS['gzipcompress'] : 0 );

$drop = (!empty($HTTP_POST_VARS['drop']))? intval($HTTP_POST_VARS['drop']) : ( (!empty($HTTP_GET_VARS['drop']))? intval($HTTP_GET_VARS['drop']) : 0 );

Any idea on how to get the following error fixed?...

Parse error: parse error, unexpected T_VARIABLE in /home/vigilant/public_html/board/admin/admin_db_utilities.php on line 702

Remember, this error appears in the left side of my phpBB 2.x admin panel.

Help appreciated-- thanks.

jatar_k




msg:1279108
 10:34 pm on Feb 21, 2006 (gmt 0)

$tables[] = 'shout'

that line is missing the ; should be

$tables[] = 'shout';

Birdman




msg:1279109
 10:35 pm on Feb 21, 2006 (gmt 0)

Oooops! My bad! I left a semicolon out.

if ( isset($HTTP_POST_VARS['additional_tables']) )
{
$additional_tables = $HTTP_POST_VARS['additional_tables'];
} elseif ( $HTTP_GET_VARS['additional_tables'] ) {
$additional_tables = $HTTP_GET_VARS['additional_tables']
;
} else {
$additional_tables = '';
}

jatar_k




msg:1279110
 10:36 pm on Feb 21, 2006 (gmt 0)

just as future reference as well

whenever installing mods

keep copies of all changed files before you change anything
always look at the code you added for the mod before anything else

I am guessing that is added code since it says

// Start add - Fully integrated shoutbox MOD
// End add - Fully integrated shoutbox MOD

;)

vigilantweather




msg:1279111
 10:56 pm on Feb 21, 2006 (gmt 0)

Sorry guys... but both of your suggestions give new errors!

Thanks!

Details:

Birdman's recent suggestion gives me this error (same place I'm receiving the error for both of your suggestions):

Parse error: parse error, unexpected T_IF in /home/vigilant/public_html/board/admin/admin_db_utilities.php on line 702

jatar_k's suggestion with the ';' gives me this:

Parse error: parse error, unexpected T_DOUBLE_ARROW, expecting ')' in /home/vigilant/public_html/board/admin/admin_board.php on line 200

I'm convinced that jatar_k's suggestion gets me out of the trouble with admin_db_utilities... and moves me on to the other file errors...

What a mess I am in!

jatar_k




msg:1279112
 11:01 pm on Feb 21, 2006 (gmt 0)

try using both together then

add the ; first, which gives you the second error

then replace line 702 with Birdman's code and that might help

vigilantweather




msg:1279113
 11:44 pm on Feb 21, 2006 (gmt 0)

Thanks for the help guys, it worked...

But now I face this error...

Parse error: parse error, unexpected T_DOUBLE_ARROW, expecting ')' in /home/vigilant/public_html/board/admin/admin_board.php on line 200

admin/admin_board.php below --- lines 198 through 204:

"L_ENABLE_GZIP" => $lang['Enable_gzip'],
"L_ENABLE_PRUNE" =>// Start add - Fully integrated shoutbox MOD
' L_PRUNE_SHOUTS' => $$lang['Prune_shouts ' ];
' L_PRUNE_SHOUTS_EXPLAIN' => $$lang['Prune_shouts_explain ' ],
// End add - Fully integrated shoutbox MOD
$$lang['Enable_prune ' ],
"L_ALLOW_HTML" => $lang['Allow_HTML'],

Hint: Line 200 is ' L_PRUNE_SHOUTS' => $$lang['Prune_shouts ' ];

Any ideas on how to get me out of this mess?

Thanks!

Birdman




msg:1279114
 12:27 am on Feb 22, 2006 (gmt 0)

It looks like something got cut from the previous line:

"L_ENABLE_PRUNE" => 'here', //Start add - Fully integrated shoutbox MOD

vigilantweather




msg:1279115
 12:36 am on Feb 22, 2006 (gmt 0)

By 'here', should I add that exact word or was it an example... if it was an example, I do not know what to add to it...

jatar_k




msg:1279116
 1:55 am on Feb 22, 2006 (gmt 0)

looks like a bad paste

"L_ENABLE_PRUNE" =>// Start add - Fully integrated shoutbox MOD
' L_PRUNE_SHOUTS' => $$lang['Prune_shouts ' ];
' L_PRUNE_SHOUTS_EXPLAIN' => $$lang['Prune_shouts_explain ' ],
// End add - Fully integrated shoutbox MOD
$$lang['Enable_prune ' ],
"L_ALLOW_HTML" => $lang['Allow_HTML'],

you seem to have pasted it in between a statement, the above should be

"L_ENABLE_PRUNE" =>$$lang['Enable_prune'],
// Start add - Fully integrated shoutbox MOD
' L_PRUNE_SHOUTS' => $$lang['Prune_shouts'];
' L_PRUNE_SHOUTS_EXPLAIN' => $$lang['Prune_shouts_explain'],
// End add - Fully integrated shoutbox MOD
"L_ALLOW_HTML" => $lang['Allow_HTML'],

are you sure those are supposed to $$ and not a single $

vigilantweather




msg:1279117
 3:14 am on Feb 22, 2006 (gmt 0)

That gives me this:

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/vigilant/public_html/board/admin/admin_board.php on line 202

Any idea what that means?

jatar_k




msg:1279118
 3:21 am on Feb 22, 2006 (gmt 0)

seems they have another error in there

'L_PRUNE_SHOUTS' => $$lang['Prune_shouts'];

shouldn;t have a ; ahould be a , like so

'L_PRUNE_SHOUTS' => $$lang['Prune_shouts'],

vigilantweather




msg:1279119
 4:40 am on Feb 22, 2006 (gmt 0)

No more errors! Thanks guys!

The problem I face now is:

I have no shoutbox!

Maybe it is somewhere, hiding from me...

jatar_k




msg:1279120
 6:11 am on Feb 22, 2006 (gmt 0)

rflmao

that's the funniest post I have read in a while

well, I can only suggest to walk through the installation instructions to see if anything was missed. Don't change anything, just look.

another thing, I don't think these are supposed to be $$ they should probably be single $

"L_ENABLE_PRUNE" =>$$lang['Enable_prune'],
// Start add - Fully integrated shoutbox MOD
' L_PRUNE_SHOUTS' => $$lang['Prune_shouts'];
' L_PRUNE_SHOUTS_EXPLAIN' => $$lang['Prune_shouts_explain'],
// End add - Fully integrated shoutbox MOD
"L_ALLOW_HTML" => $lang['Allow_HTML'],

also, look under the bed, I find all kinds of things there ;)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved