crust Posted August 16, 2006 Share Posted August 16, 2006 I'm getting this error from the payment shipping info page to the confirmation page on checkout. Warning: Cannot modify header information - headers already sent by (output started at /home/crust/public_html/includes/languages/english/modules/payment/moneyorder.php:23) in /home/crust/public_html/includes/functions/general.php on line 29 Here is part of the script from the file. <?php /* $Id: general.php,v 1.231 2003/07/09 01:15:48 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ //// // Stop from parsing any further PHP code function tep_exit() { tep_session_close(); exit(); } //// // Redirect to another page or site function tep_redirect($url) { if ( (ENABLE_SSL == true) && (getenv('HTTPS') == 'on') ) { // We are loading an SSL page if (substr($url, 0, strlen(HTTP_SERVER)) == HTTP_SERVER) { // NONSSL url $url = HTTPS_SERVER . substr($url, strlen(HTTP_SERVER)); // Change it to SSL } } header('Location: ' . $url); tep_exit(); } //// // Parse the data used in the html tags to ensure the tags will not break function tep_parse_input_field_data($data, $parse) { return strtr(trim($data), $parse); } function tep_output_string($string, $translate = false, $protected = false) { if ($protected == true) { return htmlspecialchars($string); } else { if ($translate == false) { return tep_parse_input_field_data($string, array('"' => '"')); } else { return tep_parse_input_field_data($string, $translate); } } } function tep_output_string_protected($string) { return tep_output_string($string, false, true); } function tep_sanitize_string($string) { $string = ereg_replace(' +', ' ', trim($string)); return preg_replace("/[<>]/", '_', $string); } //// // Return a random row from a database query function tep_random_select($query) { $random_product = ''; $random_query = tep_db_query($query); $num_rows = tep_db_num_rows($random_query); if ($num_rows > 0) { $random_row = tep_rand(0, ($num_rows - 1)); tep_db_data_seek($random_query, $random_row); $random_product = tep_db_fetch_array($random_query); } return $random_product; } //// // Return a product's name // TABLES: products function tep_get_products_name($product_id, $language = '') { global $languages_id; if (empty($language)) $language = $languages_id; $product_query = tep_db_query("select products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language . "'"); $product = tep_db_fetch_array($product_query); return $product['products_name']; } //// // Return a product's special price (returns nothing if there is no offer) // TABLES: products function tep_get_products_special_price($product_id) { $product_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$product_id . "' and status"); $product = tep_db_fetch_array($product_query); return $product['specials_new_products_price']; } //// // Return a product's stock // TABLES: products function tep_get_products_stock($products_id) { $products_id = tep_get_prid($products_id); $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); $stock_values = tep_db_fetch_array($stock_query); Link to comment Share on other sites More sharing options...
jasonabc Posted August 16, 2006 Share Posted August 16, 2006 you have whitespace in your PHP file that is being sent to the browser. This means that headers are sent in the HTTP request and the redirect cannot work. Strip out all the whitespace before the header('Location: ' . $url); part on line 29 and it should work. Jason My Contributions: Paypal Payflow PRO | Rollover Category Images | Authorize.net Invoice Number Fix Link to comment Share on other sites More sharing options...
crust Posted August 17, 2006 Author Share Posted August 17, 2006 you have whitespace in your PHP file that is being sent to the browser. This means that headers are sent in the HTTP request and the redirect cannot work. Strip out all the whitespace before the header('Location: ' . $url); part on line 29 and it should work. I changed line 29 to this header('Location:'.$url); To take out the extra space. I still seem to be having the problem. what exactly do you mean by extra whitespace? Link to comment Share on other sites More sharing options...
jasonabc Posted August 17, 2006 Share Posted August 17, 2006 Don't change that bit of code. There's nothing wrong with it. Read this about the whitespace problem: http://www.geeklog.net/faqman/index.php?op=view&t=38 Jason My Contributions: Paypal Payflow PRO | Rollover Category Images | Authorize.net Invoice Number Fix Link to comment Share on other sites More sharing options...
crust Posted August 17, 2006 Author Share Posted August 17, 2006 Don't change that bit of code. There's nothing wrong with it. Read this about the whitespace problem: http://www.geeklog.net/faqman/index.php?op=view&t=38 I read about the whitespace problem but am still a little confused.. I'm not a programmer I'm new to this. Here is the whole script with the whitespace problem. What exactly do I need to change? <?php /* $Id: moneyorder.php,v 1.6 2003/01/24 21:36:04 thomasamoulton Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2002 osCommerce Released under the GNU General Public License */ define('MODULE_PAYMENT_MONEYORDER_TEXT_TITLE', '<font size=3>Cash/Check/Money Order</font><br>(Do not mail coins. Checks take up to 2 weeks to clear.)'); define('MODULE_PAYMENT_MONEYORDER_TEXT_DESCRIPTION', 'Make Payable To: CRUSTPUNKS ' . MODULE_PAYMENT_MONEYORDER_PAYTO . '<br><br>Send To:<br>' . nl2br(STORE_NAME_ADDRESS) . '<br><br>' . 'Your order will not ship until we receive payment.'); define('MODULE_PAYMENT_MONEYORDER_TEXT_EMAIL_FOOTER', "Make Payable To: CRUSTPUNKS ". MODULE_PAYMENT_MONEYORDER_PAYTO . "Send To:" . STORE_NAME_ADDRESS . "" . 'Your order will not ship until we receive payment.'); ?> Link to comment Share on other sites More sharing options...
jasonabc Posted August 17, 2006 Share Posted August 17, 2006 that code is a different file (moneyorder.php) to the one you posted yesterday (general.php). As it says in that article - remove the line breaks and spaces from that file - so change it to this: <?php /* $Id: general.php,v 1.231 2003/07/09 01:15:48 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright ? 2003 osCommerce Released under the GNU General Public License */ //// // Stop from parsing any further PHP code function tep_exit() { tep_session_close(); exit(); } //// // Redirect to another page or site function tep_redirect($url) { if ( (ENABLE_SSL == true) && (getenv('HTTPS') == 'on') ) { // We are loading an SSL page if (substr($url, 0, strlen(HTTP_SERVER)) == HTTP_SERVER) { // NONSSL url $url = HTTPS_SERVER . substr($url, strlen(HTTP_SERVER)); // Change it to SSL } Jason My Contributions: Paypal Payflow PRO | Rollover Category Images | Authorize.net Invoice Number Fix Link to comment Share on other sites More sharing options...
crust Posted August 17, 2006 Author Share Posted August 17, 2006 that code is a different file (moneyorder.php) to the one you posted yesterday (general.php). As it says in that article - remove the line breaks and spaces from that file - so change it to this: <?php /* $Id: general.php,v 1.231 2003/07/09 01:15:48 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright ? 2003 osCommerce Released under the GNU General Public License */ //// // Stop from parsing any further PHP code function tep_exit() { tep_session_close(); exit(); } //// // Redirect to another page or site function tep_redirect($url) { if ( (ENABLE_SSL == true) && (getenv('HTTPS') == 'on') ) { // We are loading an SSL page if (substr($url, 0, strlen(HTTP_SERVER)) == HTTP_SERVER) { // NONSSL url $url = HTTPS_SERVER . substr($url, strlen(HTTP_SERVER)); // Change it to SSL } I'm getting this error on the homepage after I make the change Parse error: parse error, unexpected $ in /home/crust/public_html/includes/functions/general.php on line 1275 Thats the last line of the script.. on that file. Is it because theres more whitespace through out the file? Link to comment Share on other sites More sharing options...
safoo Posted August 17, 2006 Share Posted August 17, 2006 why don't you paste lines 1265-1275? Link to comment Share on other sites More sharing options...
jasonabc Posted August 18, 2006 Share Posted August 18, 2006 also - how are you editing this file? general.php does not have any whitespace in it - and yours does. If you are using OSC's File Manager to edit this file - cease immediately. It causes lots of problems. Jason My Contributions: Paypal Payflow PRO | Rollover Category Images | Authorize.net Invoice Number Fix Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.