I have a problem with a particular file with in an OSCommerce store I have just started to work with.
It was fine for the first couple of days but now it has begun to show this error though Im pretty sure I haven't touch any related files yet.
Parse error: syntax error, unexpected T_REQUIRE in /home/public_html/checkout_shipping.php on line 1
Here is an example of what some of the code looks like before its downloaded.
PHP Code:
<?php
/*
$Id: checkout_shipping.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('includes/application_top.php');
require('includes/classes/http_client.php');
// if the customer is not logged on, redirect them to the login page
if (!tep_session_is_registered('customer_id')) {
$navigation->set_snapshot();
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
}
// if there is nothing in the customers cart, redirect them to the shopping cart page
if ($cart->count_contents() < 1) {
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
}
// if no shipping destination address was selected, use the customers own address as default
if (!tep_session_is_registered('sendto')) {
tep_session_register('sendto');
$sendto = $customer_default_address_id;
} else {
// verify the selected shipping address
if ( (is_array($sendto) && empty($sendto)) || is_numeric($sendto) ) {
$check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$sendto . "'");
$check_address = tep_db_fetch_array($check_address_query);
if ($check_address['total'] != '1') {
$sendto = $customer_default_address_id;
if (tep_session_is_registered('shipping')) tep_session_unregister('shipping');
}
}
}
Here is the same piece of code once uploaded.
This doesnt seem to look the same for some reason so Ill explain the best I can.
The file basically loses all its lines. going from 343 lines down to 4, causing alot of code to comment itself out among other problems too aswell
PHP Code:
<?php /* $Id: checkout_shipping.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('includes/application_top.php'); require('includes/classes/http_client.php');
// if the customer is not logged on, redirect them to the login page
if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); }// if there is nothing in the customers cart, redirect them to the shopping cart page if ($cart->count_contents() < 1) { tep_redirect(tep_href_link(FILENAME_SHOPPING_CART)); }// if no shipping destination address was selected, use the customers own address as default if (!tep_session_is_registered('sendto')) { tep_session_register('sendto'); $sendto = $customer_default_address_id; } else {// verify the selected shipping address if ( (is_array($sendto) && empty($sendto)) || is_numeric($sendto) ) { $check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$sendto . "'"); $check_address = tep_db_fetch_array($check_address_query); if ($check_address['total'] != '1') { $sendto = $customer_default_address_id; if (tep_session_is_registered('shipping')) tep_session_unregister('shipping'); } } }
As I haven't had a problem like this before I dont even know what to search for to begin trying to fix it.
This problem seems to be with this file only as the rest of the site it working fine, so if anyone has an idea, throw it at me.
Thanks in advanced.