Results 1 to 10 of 10
  1. #1
    Join Date
    Feb 2004
    Posts
    59

    Unanswered: Parse Error - Unexpected ;

    Hi!

    I added some code to a working PHP page, and now I get an "unexpected ; parse error". Can anyone help me with this? It states the problem is in line: 47 of the following code. If I remove the semi-colon I get a different error.

    Code:
    PHP Code:
    <?php /*************************************************************************** *                              page_tail.php *                            ------------------- *   begin                : Saturday, Feb 13, 2001 *   copyright            : (C) 2001 The phpBB Group *   email                : support@phpbb.com * *   $Id: page_tail.php,v 1.27.2.2 2002/11/26 11:42:12 psotfx Exp $ * * ***************************************************************************/ /*************************************************************************** * *   This program is free software; you can redistribute it and/or modify *   it under the terms of the GNU General Public License as published by *   the Free Software Foundation; either version 2 of the License, or *   (at your option) any later version. * ***************************************************************************/ if ( !defined('IN_PHPBB') ) {   die('Hacking attempt'); } // // Show the overall footer. // $copyright1 = ($board_config['custom_tail_msg1'] != NULL) ? '<div>' . $board_config['custom_tail_msg1'] . '</div>' ''; $copyright2 = ($board_config['custom_tail_msg2'] != NULL) ? '<div>' . $board_config['custom_tail_msg2'] . '</div>' ''; $copyright3 = ($board_config['custom_tail_msg3'] != NULL) ? '<div>' . $board_config['custom_tail_msg3'] . '</div>' ''; $admin_link = ( $userdata['user_level'] == ADMIN ) ? '<a href="admin/index.' $phpEx '?sid=' $userdata['session_id'] . '">' $lang['Admin_panel'] . '</a><br /><br />' ''; $template->set_filenames(array(   'overall_footer' => ( empty($gen_simple_header) ) ? 'overall_footer.tpl' 'simple_footer.tpl') ); $template->assign_vars(array(   'PHPBB_VERSION' => '2' $board_config['version'],   'TRANSLATION_INFO' => ( isset($lang['TRANSLATION_INFO']) ) ? $lang['TRANSLATION_INFO'] : '',   'ADMIN_LINK' => $admin_link,   'COPYRIGHT1' => $copyright1,   'COPYRIGHT2' => $copyright2,   'COPYRIGHT3' => $copyright3, ); $template->pparse('overall_footer'); // // Close our DB connection. // $db->sql_close(); // // Compress buffered output if required and send to browser // if ( $do_gzip_compress ) {   //   // Borrowed from php.net!   //   $gzip_contents ob_get_contents();   ob_end_clean();   $gzip_size strlen($gzip_contents);   $gzip_crc crc32($gzip_contents);   $gzip_contents gzcompress($gzip_contents9);   $gzip_contents substr($gzip_contents0strlen($gzip_contents) - 4);   echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";   echo $gzip_contents;   echo pack('V'$gzip_crc);   echo pack('V'$gzip_size); } exit; ?>
    I don't really know PHP, was just following a mod... any ideas?

    To see this error in action, you can go to: http://www.comperfection.com/bboards, and the error's at the bottom of the page.

    Thanks in advance.
    Last edited by mateo107; 01-02-05 at 15:48. Reason: title fix
    -Matt H-
    www.comperfection.com

  2. #2
    Join Date
    Jul 2003
    Posts
    73
    The problem is with this line:

    PHP Code:
    $template->assign_vars(array(
      
    'PHPBB_VERSION' => '2' $board_config['version'],
      
    'TRANSLATION_INFO' => ( isset($lang['TRANSLATION_INFO']) ) ?
    $lang['TRANSLATION_INFO'] : '',
      
    'ADMIN_LINK' => $admin_link,
      
    'COPYRIGHT1' => $copyright1,
      
    'COPYRIGHT2' => $copyright2,
      
    'COPYRIGHT3' => $copyright3,
    ); 
    You didn't put a close bracket in your ternary condition.

    Try this:
    PHP Code:
    $template->assign_vars(array(
      
    'PHPBB_VERSION' => '2' $board_config['version'],
      
    'TRANSLATION_INFO' => ( isset($lang['TRANSLATION_INFO']) ) ?
    $lang['TRANSLATION_INFO'] : ''),
      
    'ADMIN_LINK' => $admin_link,
      
    'COPYRIGHT1' => $copyright1,
      
    'COPYRIGHT2' => $copyright2,
      
    'COPYRIGHT3' => $copyright3,
    ); 
    Joel Dixon
    Analyst Programmer
    Melbourne, Australia

  3. #3
    Join Date
    Feb 2004
    Posts
    59

    thank you

    thank you very much for the suggestion... now i get this error:

    Parse error: parse error, unexpected T_DOUBLE_ARROW in /public_html/bboards/includes/page_tail.php on line 44.

    As you might guess, I'm definitely not an avid PHPer :-)

    Thanks for your help so far! I hope we can get this working!
    -Matt H-
    www.comperfection.com

  4. #4
    Join Date
    Jul 2003
    Posts
    73
    Looks like another syntax error with a ternary operation:

    Try changing this:
    PHP Code:
    $template->set_filenames(array(
      
    'overall_footer' => ( empty($gen_simple_header) ) ?
    'overall_footer.tpl' 'simple_footer.tpl')
    ); 
    to this:
    PHP Code:
    $template->set_filenames(array(
      
    'overall_footer' => ((empty($gen_simple_header) ) ?
    'overall_footer.tpl' 'simple_footer.tpl'))
    ); 
    Joel Dixon
    Analyst Programmer
    Melbourne, Australia

  5. #5
    Join Date
    Feb 2004
    Posts
    59
    Joel, thank you so much for your help.. I think we're getting somewhere, but now the errors' moved to line 45:

    Parse error: parse error, unexpected T_DOUBLE_ARROW in /home/public_html/bboards/includes/page_tail.php on line 45...

    I'm assuming another failure to end something, but just don't know where or what to add.

    much appreciation to you (and all else) for helping me with this! :-)
    -Matt H-
    www.comperfection.com

  6. #6
    Join Date
    Jul 2003
    Posts
    73
    Could you repost the entire script (with your changes) - so I can see what's on your current line 45?
    Joel Dixon
    Analyst Programmer
    Melbourne, Australia

  7. #7
    Join Date
    Feb 2004
    Posts
    59
    Code:
    <?php
    /***************************************************************************
     *                              page_tail.php
     *                            -------------------
     *   begin                : Saturday, Feb 13, 2001
     *   copyright            : (C) 2001 The phpBB Group
     *   email                : support@phpbb.com
     *
     *   $Id: page_tail.php,v 1.27.2.2 2002/11/26 11:42:12 psotfx Exp $
     *
     *
     ***************************************************************************/
    
    /***************************************************************************
     *
     *   This program is free software; you can redistribute it and/or modify
     *   it under the terms of the GNU General Public License as published by
     *   the Free Software Foundation; either version 2 of the License, or
     *   (at your option) any later version.
     *
     ***************************************************************************/
    
    if ( !defined('IN_PHPBB') )
    {
    	die('Hacking attempt');
    }
    
    //
    // Show the overall footer.
    //
    $copyright1 = ($board_config['custom_tail_msg1'] != NULL) ? '<div>' . $board_config['custom_tail_msg1'] . '</div>' : '';
    $copyright2 = ($board_config['custom_tail_msg2'] != NULL) ? '<div>' . $board_config['custom_tail_msg2'] . '</div>' : '';
    $copyright3 = ($board_config['custom_tail_msg3'] != NULL) ? '<div>' . $board_config['custom_tail_msg3'] . '</div>' : '';
    $admin_link = ( $userdata['user_level'] == ADMIN ) ? '<a href="admin/index.' . $phpEx . '?sid=' . $userdata['session_id'] . '">' . $lang['Admin_panel'] . '</a><br /><br />' : '';
    
    $template->set_filenames(array( 
      'overall_footer' => ((empty($gen_simple_header) ) ? 
    'overall_footer.tpl' : 'simple_footer.tpl')) 
    ); 
    
    $template->assign_vars(array(
      'PHPBB_VERSION' => '2' . $board_config['version'],
      'TRANSLATION_INFO' => ( isset($lang['TRANSLATION_INFO']) ) ?
    $lang['TRANSLATION_INFO'] : ''),
      'ADMIN_LINK' => $admin_link,
      'COPYRIGHT1' => $copyright1,
      'COPYRIGHT2' => $copyright2,
      'COPYRIGHT3' => $copyright3,
    );
    
    
    $template->pparse('overall_footer');
    
    //
    // Close our DB connection.
    //
    $db->sql_close();
    
    //
    // Compress buffered output if required and send to browser
    //
    if ( $do_gzip_compress )
    {
    	//
    	// Borrowed from php.net!
    	//
    	$gzip_contents = ob_get_contents();
    	ob_end_clean();
    
    	$gzip_size = strlen($gzip_contents);
    	$gzip_crc = crc32($gzip_contents);
    
    	$gzip_contents = gzcompress($gzip_contents, 9);
    	$gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4);
    
    	echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";
    	echo $gzip_contents;
    	echo pack('V', $gzip_crc);
    	echo pack('V', $gzip_size);
    }
    
    exit;
    
    ?>
    -Matt H-
    www.comperfection.com

  8. #8
    Join Date
    Jul 2003
    Posts
    73
    Change:

    PHP Code:
    $template->assign_vars(array(
      
    'PHPBB_VERSION' => '2' $board_config['version'],
      
    'TRANSLATION_INFO' => ( isset($lang['TRANSLATION_INFO']) ) ?
    $lang['TRANSLATION_INFO'] : ''),
      
    'ADMIN_LINK' => $admin_link,
      
    'COPYRIGHT1' => $copyright1,
      
    'COPYRIGHT2' => $copyright2,
      
    'COPYRIGHT3' => $copyright3,
    ); 
    to:
    PHP Code:
    $template->assign_vars(array(
      
    'PHPBB_VERSION' => '2' $board_config['version'],
      
    'TRANSLATION_INFO' => ((isset($lang['TRANSLATION_INFO'])) ?
    $lang['TRANSLATION_INFO'] : ''),
      
    'ADMIN_LINK' => $admin_link,
      
    'COPYRIGHT1' => $copyright1,
      
    'COPYRIGHT2' => $copyright2,
      
    'COPYRIGHT3' => $copyright3)
    ); 
    Joel Dixon
    Analyst Programmer
    Melbourne, Australia

  9. #9
    Join Date
    Feb 2004
    Posts
    59
    Thank you, Thank you, Thank you, Thank you!!!


    I finally have my footer back again!!!

    :-)

    Best Regards, and thanks again for so many wonderful follow ups!
    -Matt H-
    www.comperfection.com

  10. #10
    Join Date
    Jan 2005
    Posts
    1

    Exclamation I Need Some Help With Mine PLEASE!!! Very Greatful...

    I am having the same problems mine is saying parse error for $ on line 85 and for whatever reason I am thinking there will be more wrong then just that is there anyone here that can help me? I would greatly appreciate it! Here is the code for our PHP site. My e-mail is them_gaming@yahoo.com msn messenger is grockith@yahoo.com msn is just messenger no e-mail.

    <?php
    /************************************************** *************************
    * db.php
    * -------------------
    * begin : Saturday, Feb 13, 2001
    * copyright : (C) 2001 The phpBB Group
    * email : support@phpbb.com
    *
    * $Id: db.php,v 1.10 2002/03/18 13:35:22 psotfx Exp $
    *
    *
    ************************************************** *************************/

    /************************************************** *************************
    * This file is part of the phpBB2 port to Nuke 6.0 (c) copyright 2002
    * by Tom Nitzschner (tom@toms-home.com)
    * http://bbtonuke.sourceforge.net (or http://www.toms-home.com)
    *
    * As always, make a backup before messing with anything. All code
    * release by me is considered sample code only. It may be fully
    * functual, but you use it at your own risk, if you break it,
    * you get to fix it too. No waranty is given or implied.
    *
    * Please post all questions/request about this port on http://bbtonuke.sourceforge.net first,
    * then on my site. All original header code and copyright messages will be maintained
    * to give credit where credit is due. If you modify this, the only requirement is
    * that you also maintain all original copyright messages. All my work is released
    * under the GNU GENERAL PUBLIC LICENSE. Please see the README for more information.
    *
    ************************************************** *************************/

    /************************************************** *************************
    *
    * This program is free software; you can redistribute it and/or modify
    * it under the terms of the GNU General Public License as published by
    * the Free Software Foundation; either version 2 of the License, or
    * (at your option) any later version.
    *
    ************************************************** *************************/

    global $forum_admin;
    if ($forum_admin == 1) {
    $the_include = "../../../db";
    } elseif ($inside_mod == 1) {
    $the_include = "../../db";
    } else {
    $the_include = "db";
    }

    switch($dbtype) {

    case 'MySQL':
    include("".$the_include."/mysql.php");
    break;

    case 'mysql4':
    include("".$the_include."/mysql4.php");
    break;

    case 'postgres':
    include("".$the_include."/postgres7.php");
    break;

    case 'mssql':
    include("".$the_include."/mssql.php");
    break;

    case 'oracle':
    include("".the_include."/oracle.php");
    break;

    case 'msaccess':
    include("".$the_include."/msaccess.php");
    break;

    case 'mssql-odbc':
    include("".$the_include."/mssql-odbc.php");
    break;

    case 'db2':
    include("".$the_include."/db2.php");
    break;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •