Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Didn't follow rule #1


Eternal_Howl

Recommended Posts

Posted

Hi there,

 

I'm hoping someone could guide me and advise me what I have accidentally deleted near the end of the page column_right.php to cause a 500 error. I'm guessing it's a , ' or a ; but not sure which.

 

Yes, I know, back up, back up, back up. Normally I do. Hindsight is 20/20

 

<?php
/*
 $Id: column_right.php 1739 2007-12-20 00:52:16Z hpdl $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require(DIR_WS_BOXES . 'shopping_cart.php');

 if (isset($HTTP_GET_VARS['products_id'])) include(DIR_WS_BOXES . 'manufacturer_info.php');

 if (tep_session_is_registered('customer_id')) include(DIR_WS_BOXES . 'order_history.php');

 if (isset($HTTP_GET_VARS['products_id'])) {
   if (tep_session_is_registered('customer_id')) {
     $check_query = tep_db_query("select count(*) as count from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$customer_id . "' and global_product_notifications = '1'");
     $check = tep_db_fetch_array($check_query);
     if ($check['count'] > 0) {
       include(DIR_WS_BOXES . 'best_sellers.php');
     } else {
       include(DIR_WS_BOXES . 'product_notifications.php');
     }
   } else {
     include(DIR_WS_BOXES . 'product_notifications.php');
   }
 } else {
   include(DIR_WS_BOXES . 'best_sellers.php');
 }

 if (isset($HTTP_GET_VARS['products_id'])) {
   if (basename($PHP_SELF) != FILENAME_TELL_A_FRIEND) include(DIR_WS_BOXES . 'tell_a_friend.php');
 } else {
   include(DIR_WS_BOXES . 'specials.php');
 }

 //require(DIR_WS_BOXES . 'reviews.php');//

:o   if (substr(basename($PHP_SELF), 0, 8) != 'checkout') {
    require(DIR_WS_BOXES . 'whats_new.php');
 require(DIR_WS_BOXES . 'search.php');
 require(DIR_WS_BOXES . 'information.php');
 // include(DIR_WS_BOXES . 'currencies.php');//  }

?> :o 

 

I have stamped the area where I think I lost something with a shocked smiley face, which shows up an : o when in code.

The // is meant to be here it is though. Whatever I just did made my site vanish and become replaced by a 500 error.

Posted

Step one: Just use the file from the oscommerce installer.

Step two: Save a backup of all files on local PC.

Step three: Save a database backup to local PC.

Step four: Experiment all you want , and as you get each contribution working as it should preform steps 1 thru 3 again.

Step five keep a few previous backups as you progress in case you later find an error and need to go back and find it.

Posted

Hi there,

 

I'm hoping someone could guide me and advise me what I have accidentally deleted near the end of the page column_right.php to cause a 500 error. I'm guessing it's a , ' or a ; but not sure which.

 

Yes, I know, back up, back up, back up. Normally I do. Hindsight is 20/20

 

<?php
/*
 $Id: column_right.php 1739 2007-12-20 00:52:16Z hpdl $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require(DIR_WS_BOXES . 'shopping_cart.php');

 if (isset($HTTP_GET_VARS['products_id'])) include(DIR_WS_BOXES . 'manufacturer_info.php');

 if (tep_session_is_registered('customer_id')) include(DIR_WS_BOXES . 'order_history.php');

 if (isset($HTTP_GET_VARS['products_id'])) {
   if (tep_session_is_registered('customer_id')) {
     $check_query = tep_db_query("select count(*) as count from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$customer_id . "' and global_product_notifications = '1'");
     $check = tep_db_fetch_array($check_query);
     if ($check['count'] > 0) {
       include(DIR_WS_BOXES . 'best_sellers.php');
     } else {
       include(DIR_WS_BOXES . 'product_notifications.php');
     }
   } else {
     include(DIR_WS_BOXES . 'product_notifications.php');
   }
 } else {
   include(DIR_WS_BOXES . 'best_sellers.php');
 }

 if (isset($HTTP_GET_VARS['products_id'])) {
   if (basename($PHP_SELF) != FILENAME_TELL_A_FRIEND) include(DIR_WS_BOXES . 'tell_a_friend.php');
 } else {
   include(DIR_WS_BOXES . 'specials.php');
 }

 //require(DIR_WS_BOXES . 'reviews.php');//

:o   if (substr(basename($PHP_SELF), 0, 8) != 'checkout') {
	require(DIR_WS_BOXES . 'whats_new.php');
 require(DIR_WS_BOXES . 'search.php');
 require(DIR_WS_BOXES . 'information.php');
 // include(DIR_WS_BOXES . 'currencies.php');//  }

?> :o 

 

I have stamped the area where I think I lost something with a shocked smiley face, which shows up an : o when in code.

The // is meant to be here it is though. Whatever I just did made my site vanish and become replaced by a 500 error.

 

 

 

Hi,

You have commented out an ending curly brace

 

  if (substr(basename($PHP_SELF), 0, 8) != 'checkout') {
   require(DIR_WS_BOXES . 'whats_new.php');
 require(DIR_WS_BOXES . 'search.php');
 require(DIR_WS_BOXES . 'information.php');
 // include(DIR_WS_BOXES . 'currencies.php');//  }

?> 


 

Should look

 

  if (substr(basename($PHP_SELF), 0, 8) != 'checkout') {
	require(DIR_WS_BOXES . 'whats_new.php');
 require(DIR_WS_BOXES . 'search.php');
 require(DIR_WS_BOXES . 'information.php');
 // include(DIR_WS_BOXES . 'currencies.php');  
}

?> 

 

However its not certain this is the cause of the 500 error as this is usually for permissions type errors, as a rule anyhow!

Check the permissions are on 644 when you are correcting.

The curly brace will usually give an unexpected $end error

 

These characters

 

 

 

:o

 

 

Don't belong but i not sure if its a paste thing into the code box or not

Sometimes you're the dog and sometimes the lamp post

[/url]

My Contributions

Posted

// deletes to the end of the line

/* this part will be deleted */ this will not

 

You wanted to use /* */, not // //. Or, you can move the } to the next line and use //.

 

As for the 500 error, you probably introduced a blank or two before the first <?php or after the last ?>, or added a blank line at the beginning or end of the file, or uploaded in the wrong mode, or your FTP set illegal permissions, or... See http://www.oscommerce.com/forums/topic/345637-internal-server-error/page__view__findpost__p__1442374

Posted

Thanks for the reply guys. I got it sorted. Followed first advice and just reinstalled. Weird thing was I only added one line and then removed it when I broke everything.

Sorry I never got a chance to get back to you earlier.

Posted

Thanks for the reply guys. I got it sorted. Followed first advice and just reinstalled. Weird thing was I only added one line and then removed it when I broke everything.

Sorry I never got a chance to get back to you earlier.

 

No Problem, thanks for posting your solution :- )

Nic

Sometimes you're the dog and sometimes the lamp post

[/url]

My Contributions

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...