Jump to content
Latest News: (loading..)
TheDukeOfHurl

Shop Not Functional After Hosting Change...

Recommended Posts

Hello!

I recently switched to a different host and am now unable to get my osCommerce install to function properly. When I attempt to launch it, I receive the following error:

Parse error: syntax error, unexpected '}', expecting '{' in /home/bigmus5/public_html/shop/includes/functions/database.php on line 13

What do I need to change to make this work?

Thanks!

Share this post


Link to post
Share on other sites

The error is saying the code is incorrect. That's strange because it should have failed before the move. The fix is to edit that file and change the symbol shown as directed at line 13. It would be better if you posted that line here, with a few lines above and below it, so someone can verify the fix but based on the error, making that change should fix it.

I would be concerned about how the code got changed. Assuming the shop worked prior to the move, someone had to have edited that file, which almost never gets edited.

Share this post


Link to post
Share on other sites
Posted (edited)

Here are the first forty lines:

<?php
/*
  $Id$

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2013 osCommerce

  Released under the GNU General Public License
*/

  function tep_db_connect($server = 'localhost', $username = 'xyz_shop', $password = 'xyz123abcdef', $database = 'xyz_shop', $link = 'db_link') }
    global $$link;

    if (USE_PCONNECT == 'true') {
      $server = 'p:' . $server;
    }

    $$link = mysqli_connect($server, $username, $password, $database);

    if ( !mysqli_connect_errno() ) {
      mysqli_set_charset($$link, 'utf8');
    } 

    return $$link;

  function tep_db_close($link = 'db_link') {
    global $$link;

    return mysqli_close($$link);
  }

  function tep_db_error($query, $errno, $error) { 
    if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) {
      error_log('ERROR: [' . $errno . '] ' . $error . "\n", 3, STORE_PAGE_PARSE_TIME_LOG);
    }

    die('<font color="#000000"><strong>' . $errno . ' - ' . $error . '<br /><br />' . $query . '<br /><br /><small><font color="#ff0000">[TEP STOP]</font></small><br /><br /></strong></font>');
  }

Edited by burt
anonymization of important data. PLEASE BE CAREFUL OF WHAT YOU POST!!!

Share this post


Link to post
Share on other sites
Posted (edited)
15 hours ago, www.BigMusicGeek.com said:

function tep_db_connect(...) }
    global $$link;

For clarification, this is line thirteen.

Edited by burt
ANONYMIZATION AGAIN

Share this post


Link to post
Share on other sites

The reason for the failure is that this part

$link = 'db_link') }

should be

$link = 'db_link') {

However, someone has edited that while line to contain your database details. That will break when moving to a new host unless the database details stay the same, which they shouldn't for security reasons. I suggest you replace that whole line with

  function tep_db_connect($server = DB_SERVER, $username = DB_SERVER_USERNAME, $password = DB_SERVER_PASSWORD, $database = DB_DATABASE, $link = 'db_link') {

Whoever made that change didn't understand how oscommerce works so I would be concerned that they made other such changes. If you paid someone to work on your site, I suggest looking for someone who understands the code.

Also, this post will be seen by hackers and they now have your database login credentials so you need to change those right away.

Share this post


Link to post
Share on other sites

I appreciate the FYI.

Now that the issue with line thirteen has been addressed, I am getting a syntax error for line 264, which only contains the following:

?> {

Thanks!

Share this post


Link to post
Share on other sites

It is because the { is in the wrong place. As mentioned in my reply to your PM, you should download the latest version of CE and use the database file from it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×