Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Cannot send session cache limiter


bswinnerton

Recommended Posts

Hey Everyone,

 

I'm very new to OSCommerce, heard a lot about it but never actually used it. Right now i'm trying to incorporate the shopping cart into an already designed website. So the entire cart is inside of a table. However the way in which I added the code, I now get the following message:

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /var/www/products/catalog/index.php:10) in /var/www/products/catalog/includes/functions/sessions.php on line 102

 

Here is the beginning of my page:

 

<html>


<body onload="MM_preloadImages('../../images/navbar_contact.png','../../images/navbar_products.png','../../images/navbar_home.png','../../images/navbar_about.png')">


<br>
<div id="navbar" align="center">
<img src="../../images/prp_logo.png" alt="PRP Logo" width="216" height="63" align="middle">  
<img src="../../images/navbar_home.png" alt="" border="0" align="middle" usemap="#navbarmap" id="Image1">
<map name="navbarmap" id="navbarmap">
  <area shape="poly" coords="144,39,64,39,6,4,144,4" href="../../../prp" onmouseover="MM_swapImage('Image1','','../../images/navbar_home.png',1)" onmouseout="MM_swapImgRestore()" alt="Navigation Bar Home">
  <area shape="rect" coords="146,4,289,40" href="../../products/index.html" onmouseover="MM_swapImage('Image1','','../../images/navbar_products.png',1)" onmouseout="MM_swapImgRestore()" alt="Navigation Bar Products">
  <area shape="rect" coords="290,4,423,40" href="../../about.html" onmouseover="MM_swapImage('Image1','','../../images/navbar_about.png',1)" onmouseout="MM_swapImgRestore()" alt="Navigation Bar About">
  <area shape="rect" coords="424,4,568,40" href="../../contactus.html" onmouseover="MM_swapImage('Image1','','../../images/navbar_contact.png',1)" onmouseout="MM_swapImgRestore()" alt="Navigation Bar Contact">
 </map>
</div>
<br><br><br>

<table id="bodytable">
 <tr>
<td>

 

And then the shopping cart code begins. How can I fix the error? Thanks

Link to comment
Share on other sites

Looks like the page you added osC code to is a pure HTML page.

 

It needs to be a PHP page and have this code at the top:

 

<?php
 require("includes/application_top.php");
?>

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Looks like the page you added osC code to is a pure HTML page.

 

It needs to be a PHP page and have this code at the top:

 

<?php
 require("includes/application_top.php");
?>

 

Thank you very much! That solved it. I just removed the require("includes/application_top.php"); from the second start of the php to prevent a duplicate.

 

Thanks again.

Link to comment
Share on other sites

Hmm, Now I tried it with account.php, and i get:

 

Warning: Cannot modify header information - headers already sent by (output started at /var/www/products/catalog/account.php:12) in /var/www/products/catalog/includes/functions/general.php on line 33

 

Here is the code:

 

?php
 require("includes/application_top.php");
?>


<body onLoad="MM_preloadImages('../../images/navbar_contact.png','../../images/navbar_products.png','../../images/navbar_home.png','../../images/navbar_about.png')">


<br>
<div id="navbar" align="center">
<img src="../../images/prp_logo.png" alt="PRP Logo" width="216" height="63" align="middle">  
<img src="../../images/navbar_products.png" alt="" border="0" align="middle" usemap="#navbarmap" id="Image1">
<map name="navbarmap" id="navbarmap">
  <area shape="poly" coords="144,39,64,39,6,4,144,4" href="../../" onmouseover="MM_swapImage('Image1','','../../images/navbar_home.png',1)" onmouseout="MM_swapImgRestore()" alt="Navigation Bar Home">
  <area shape="rect" coords="146,4,289,40" href="../../products/catalog" onmouseover="MM_swapImage('Image1','','../../images/navbar_products.png',1)" onmouseout="MM_swapImgRestore()" alt="Navigation Bar Products">
  <area shape="rect" coords="290,4,423,40" href="../../about.html" onmouseover="MM_swapImage('Image1','','../../images/navbar_about.png',1)" onmouseout="MM_swapImgRestore()" alt="Navigation Bar About">
  <area shape="rect" coords="424,4,568,40" href="../../contactus.html" onmouseover="MM_swapImage('Image1','','../../images/navbar_contact.png',1)" onmouseout="MM_swapImgRestore()" alt="Navigation Bar Contact">
 </map>
</div>
<br><br><br>

<table id="bodytable">
 <tr>
<td>

Link to comment
Share on other sites

I've not helped with this problem.

 

Maybe you can find something here:

 

Click Me

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

<_<

I apoligize, that was an old error, I played around with the positioning of some things and got a new one as shown as above. I am quite positive that it isn't working because of this:

 

if (!tep_session_is_registered('customer_id')) {
$navigation->set_snapshot();
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

 

Because If i put that where the first php tag opens, it works but ignores my html. What does that code do? Obviously something with SSL correct? Would it be safe to remove?

Link to comment
Share on other sites

Loosely translated that code snippet says:

 

if ( the customer is NOT logged in ) {
save the page we are on now
go to the login page

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Well, I'm slowly making progress. I have both of the pages (login.php and account.php) looking the way that I want them to. But when I go to login I get the following:

 

Warning: Cannot modify header information - headers already sent by (output started at /var/www/products/catalog/login.php:14) in /var/www/products/catalog/includes/functions/general.php on line 33

 

and the url is:

 

http://www.criticalwire.com/prp/products/c...?action=process

Link to comment
Share on other sites

Headers already sent

 

Explanation at the link above.

 

The problem is at /products/catalog/login.php (line 14)

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

I redid everything just to be sure, but now it just says its on line 12 instead of 14. Got rid of all the white spaces. Line 12 happens to be the beginning of <img src

 

Here is my login.php:

 

<?php
require("includes/application_top.php");
?><html>


<body onLoad="MM_preloadImages('../../images/navbar_contact.png','../../images/navbar_products.png','../../images/navbar_home.png','../../images/navbar_about.png')">


<br>
<div id="navbar" align="center">
<img src="../../images/prp_logo.png" alt="PRP Logo" width="216" height="63" align="middle">  
<img src="../../images/navbar_products.png" alt="" border="0" align="middle" usemap="#navbarmap" id="Image1">
<map name="navbarmap" id="navbarmap">
  <area shape="poly" coords="144,39,64,39,6,4,144,4" href="../../" onMouseOver="MM_swapImage('Image1','','../../images/navbar_home.png',1)" onMouseOut="MM_swapImgRestore()" alt="Navigation Bar Home">
  <area shape="rect" coords="146,4,289,40" href="../../products/catalog" onMouseOver="MM_swapImage('Image1','','../../images/navbar_products.png',1)" onMouseOut="MM_swapImgRestore()" alt="Navigation Bar Products">
  <area shape="rect" coords="290,4,423,40" href="../../about.html" onMouseOver="MM_swapImage('Image1','','../../images/navbar_about.png',1)" onMouseOut="MM_swapImgRestore()" alt="Navigation Bar About">
  <area shape="rect" coords="424,4,568,40" href="../../contactus.html" onMouseOver="MM_swapImage('Image1','','../../images/navbar_contact.png',1)" onMouseOut="MM_swapImgRestore()" alt="Navigation Bar Contact">
 </map>
</div>
<br><br><br>

<table id="bodytable">
 <tr>
<td>

 

And here is my account.php

<?php
 require("includes/application_top.php");

 if (!tep_session_is_registered('customer_id')) {
$navigation->set_snapshot();
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
 }
?><html>


<body onLoad="MM_preloadImages('../../images/navbar_contact.png','../../images/navbar_products.png','../../images/navbar_home.png','../../images/navbar_about.png')">


<br>
<div id="navbar" align="center">
<img src="../../images/prp_logo.png" alt="PRP Logo" width="216" height="63" align="middle">  
<img src="../../images/navbar_products.png" alt="" border="0" align="middle" usemap="#navbarmap" id="Image1">
<map name="navbarmap" id="navbarmap">
  <area shape="poly" coords="144,39,64,39,6,4,144,4" href="../../" onMouseOver="MM_swapImage('Image1','','../../images/navbar_home.png',1)" onMouseOut="MM_swapImgRestore()" alt="Navigation Bar Home">
  <area shape="rect" coords="146,4,289,40" href="../../products/catalog" onMouseOver="MM_swapImage('Image1','','../../images/navbar_products.png',1)" onMouseOut="MM_swapImgRestore()" alt="Navigation Bar Products">
  <area shape="rect" coords="290,4,423,40" href="../../about.html" onMouseOver="MM_swapImage('Image1','','../../images/navbar_about.png',1)" onMouseOut="MM_swapImgRestore()" alt="Navigation Bar About">
  <area shape="rect" coords="424,4,568,40" href="../../contactus.html" onMouseOver="MM_swapImage('Image1','','../../images/navbar_contact.png',1)" onMouseOut="MM_swapImgRestore()" alt="Navigation Bar Contact">
 </map>
</div>
<br><br><br>

<table id="bodytable">
 <tr>
<td>

Link to comment
Share on other sites

You need more PHP code at the top of login.php

 

Remember that it's not just a static page but also a "form" as well.

 

You'll need to add code to process the form when it's filled out.

 

This is what's in my version of it at the top:

 

<?php
/*
 $Id: login.php,v 1.80 2003/06/05 23:28:24 hpdl Exp $

 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');

// redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled (or the session has not started)
 if ($session_started == false) {
tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE));
 }

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_LOGIN);

 $error = false;
 if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process')) {
$email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']);
$password = tep_db_prepare_input($HTTP_POST_VARS['password']);

// Check if email exists
$check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
if (!tep_db_num_rows($check_customer_query)) {
  $error = true;
} else {
  $check_customer = tep_db_fetch_array($check_customer_query);
// Check that password is good
  if (!tep_validate_password($password, $check_customer['customers_password'])) {
	$error = true;
  } else {
	if (SESSION_RECREATE == 'True') {
	  tep_session_recreate();
	}

	$check_country_query = tep_db_query("select entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$check_customer['customers_id'] . "' and address_book_id = '" . (int)$check_customer['customers_default_address_id'] . "'");
	$check_country = tep_db_fetch_array($check_country_query);

	$customer_id = $check_customer['customers_id'];
	$customer_default_address_id = $check_customer['customers_default_address_id'];
	$customer_first_name = $check_customer['customers_firstname'];
	$customer_country_id = $check_country['entry_country_id'];
	$customer_zone_id = $check_country['entry_zone_id'];
	tep_session_register('customer_id');
	tep_session_register('customer_default_address_id');
	tep_session_register('customer_first_name');
	tep_session_register('customer_country_id');
	tep_session_register('customer_zone_id');

	tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_of_last_logon = now(), customers_info_number_of_logons = customers_info_number_of_logons+1 where customers_info_id = '" . (int)$customer_id . "'");

// restore cart contents
	$cart->restore_contents();

	if (sizeof($navigation->snapshot) > 0) {
	  $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
	  $navigation->clear_snapshot();
	  tep_redirect($origin_href);
	} else {
	  tep_redirect(tep_href_link(FILENAME_DEFAULT));
	}
  }
}
 }

 if ($error == true) {
$messageStack->add('login', TEXT_LOGIN_ERROR);
 }

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_LOGIN, '', 'SSL'));
?>

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...