Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Headers all ready sent


Guest

Recommended Posts

Posted

I get this error

 

Ge

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /hsphere/local/home/lardern/gaia-bio.co.uk/insect/catalog/wanted.php:1) in /hsphere/local/home/lardern/gaia-bio.co.uk/insect/catalog/includes/functions/sessions.php on line 67

 

 

Here is the page code why do I get this error?

 

<?php
/*
 $Id: shipping.php,v 1.4 2002/11/19 01:48:08 dgw_ Exp $

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

 Copyright (c) 2002 osCommerce

 Released under the GNU General Public License
*/

define('NAVBAR_TITLE', 'Do you have any Surplus stock available?');
define('HEADING_TITLE', 'Do you have any Surplus stock available?');

define('TEXT_INFORMATION', 'We are always interested in buying your surplus specimens or captive bred young. 
We are interested in all species of Tarantula, other Arachnids and other Invertebrates. 
<a href="mailto:[email protected]"> <strong>Contact us</strong></a> and 
let us know what you have available. We can either buy them off your or exchange 
for equipment, other livestock or credit to spend when ever you like. We regret 
that we are not interested in purchasing Phasmids, Snails or Cockroaches everything 
else is available. ');
?>

 

Thanks in advance,

 

Lee

Posted
I get this error

Here is the page code why do I get this error?

 

<?php
/*
?$Id: shipping.php,v 1.4 2002/11/19 01:48:08 dgw_ Exp $

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

?Copyright (c) 2002 osCommerce

?Released under the GNU General Public License
*/

define('NAVBAR_TITLE', 'Do you have any Surplus stock available?');
define('HEADING_TITLE', 'Do you have any Surplus stock available?');

define('TEXT_INFORMATION', 'We are always interested in buying your surplus specimens or captive bred young. 
We are interested in all species of Tarantula, other Arachnids and other Invertebrates. 
<a href="mailto:[email protected]"> <strong>Contact us</strong></a> and 
let us know what you have available. We can either buy them off your or exchange 
for equipment, other livestock or credit to spend when ever you like. We regret 
that we are not interested in purchasing Phasmids, Snails or Cockroaches everything 
else is available. ');
?>

 

Thanks in advance,

 

Lee

 

If I read your error correctly you need to look at your includes/function/session.php this is what it says at about that line:

 

function _sess_destroy($key) {

return tep_db_query("delete from " . TABLE_SESSIONS . " where sesskey = '" . tep_db_input($key) . "'");

}

You may also just copy up a fresh code from osCommerce or alternately here is mine.

 

<?php
/*
 $Id: sessions.php,v 1.2 2004/08/25 22:40:05 akhan Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 if (STORE_SESSIONS == 'mysql') {
   if (!$SESS_LIFE = get_cfg_var('session.gc_maxlifetime')) {
     $SESS_LIFE = 1440;
   }

   function _sess_open($save_path, $session_name) {
     return true;
   }

   function _sess_close() {
     return true;
   }

   function _sess_read($key) {
     $value_query = tep_db_query("select value from " . TABLE_SESSIONS . " where sesskey = '" . tep_db_input($key) . "' and expiry > '" . time() . "'");
     $value = tep_db_fetch_array($value_query);

     if (isset($value['value'])) {
       return $value['value'];
     }

     return false;
   }

   function _sess_write($key, $val) {
     global $SESS_LIFE;

     $expiry = time() + $SESS_LIFE;
     $value = $val;

     $check_query = tep_db_query("select count(*) as total from " . TABLE_SESSIONS . " where sesskey = '" . tep_db_input($key) . "'");
     $check = tep_db_fetch_array($check_query);

     if ($check['total'] > 0) {
       return tep_db_query("update " . TABLE_SESSIONS . " set expiry = '" . tep_db_input($expiry) . "', value = '" . tep_db_input($value) . "' where sesskey = '" . tep_db_input($key) . "'");
     } else {
       return tep_db_query("insert into " . TABLE_SESSIONS . " values ('" . tep_db_input($key) . "', '" . tep_db_input($expiry) . "', '" . tep_db_input($value) . "')");
     }
   }

   function _sess_destroy($key) {
     return tep_db_query("delete from " . TABLE_SESSIONS . " where sesskey = '" . tep_db_input($key) . "'");
   }

   function _sess_gc($maxlifetime) {
     tep_db_query("delete from " . TABLE_SESSIONS . " where expiry < '" . time() . "'");

     return true;
   }

   session_set_save_handler('_sess_open', '_sess_close', '_sess_read', '_sess_write', '_sess_destroy', '_sess_gc');
 }

 function tep_session_start() {
   return session_start();
 }

 function tep_session_register($variable) {
   global $session_started;

   if ($session_started == true) {
     return session_register($variable);
   } else {
     return false;
   }
 }

 function tep_session_is_registered($variable) {
   return session_is_registered($variable);
 }

 function tep_session_unregister($variable) {
   return session_unregister($variable);
 }

 function tep_session_id($sessid = '') {
   if (!empty($sessid)) {
     return session_id($sessid);
   } else {
     return session_id();
   }
 }

 function tep_session_name($name = '') {
   if (!empty($name)) {
     return session_name($name);
   } else {
     return session_name();
   }
 }

 function tep_session_close() {
   if (PHP_VERSION >= '4.0.4') {
     return session_write_close();
   } elseif (function_exists('session_close')) {
     return session_close();
   }
 }

 function tep_session_destroy() {
   return session_destroy();
 }

 function tep_session_save_path($path = '') {
   if (!empty($path)) {
     return session_save_path($path);
   } else {
     return session_save_path();
   }
 }

 function tep_session_recreate() {
   if (PHP_VERSION >= 4.1) {
     $session_backup = $_SESSION;

     unset($_COOKIE[tep_session_name()]);

     tep_session_destroy();

     if (STORE_SESSIONS == 'mysql') {
       session_set_save_handler('_sess_open', '_sess_close', '_sess_read', '_sess_write', '_sess_destroy', '_sess_gc');
     }

     tep_session_start();

     $_SESSION = $session_backup;
     unset($session_backup);
   }
 }
?>

 

Hope this helps!

 

Allison

We help each other, to help ourselves!

Aloha Allison!

 

Liken to wrinkles, the many paths of my life not only altered my destiny, but my appearance.

 

Poetry, the artistry of plying ones soul to the empty canvases of life. A vision without sight. A verse without darkness. Lighting each day with a prose of beauty and love.

Posted

But why do I only get this error on one page though? The rest of the site is fine. I have never edited my sessions.php file so it should not be anything different.

 

Cheers

 

Lee

Posted
The error is not in your sessions.php, but wanted.php

this is probablt trying to output data before the session has been started.

 

 

How do I fix thsi then?

Posted

If you follow the Documentation link at the top of this page to the Knowledge Base and look under Common Problems for 'headers already sent' you'll find out what's wrong.

 

Vger

Archived

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

×
×
  • Create New...