Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
File loses it structure when uploaded.
Old 04-13-2010, 07:12 PM File loses it structure when uploaded.
Average Talker

Posts: 19
Name: Terry Scarr
Trades: 0
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.

Last edited by TS153; 04-14-2010 at 08:11 AM..
TS153 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-14-2010, 12:34 AM Re: File loses it structure when uploaded.
Extreme Talker

Posts: 177
Trades: 0
Can we see checkout_shipping.php please? Also, please use [ php ] [/ php] tags (without the spaces) when posting your code.
kbfirebreather is offline
Reply With Quote
View Public Profile
 
Old 04-14-2010, 08:10 AM Re: File loses it structure when uploaded.
Average Talker

Posts: 19
Name: Terry Scarr
Trades: 0
Sorry about about the php tags.

I just went through it and took out a bunch of comments hoping it would fix it or at least help point out where the issue was better and it seems to have worked, Im still confused as to why it did it though as they were only comments.

Just goes to show that lots of caffeine, sleep deprivation and stupid ideas still work compared to yesterdays clear headed thinking.
TS153 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to File loses it structure when uploaded.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11643 seconds with 12 queries