View Full Version : Session stuff

02-23-2008, 07:39 AM
I'm including a file that has Headers and stuff and it always gives me this:
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/frazierf/public_html/forum/index.php:5) in /home/frazierf/public_html/forum/includes/header.php on line 35

Warning: Cannot modify header information - headers already sent by (output started at /home/frazierf/public_html/forum/index.php:5) in /home/frazierf/public_html/forum/includes/header.php on line 36

Here is my header.php code:

/*** *** *** *** *** ***
* @package Quadodo Login Script
* @file header.php
* @start July 25th, 2007
* @author Douglas Rennehan
* @license http://www.opensource.org/licenses/gpl-license.php
* @version 1.0.3
* @link http://webhelp.pcriot.com
*** *** *** *** *** ***
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*** *** *** *** *** ***
* Comments are always before the code they are commenting.
*** *** *** *** *** ***/
if (!defined('QUADODO_IN_SYSTEM')) {

// Report everything except E_NOTICE, because it screws a lot of stuff up...
error_reporting(E_ALL ^ E_NOTICE);

// Send some headers
header('Content-Type: text/html; charset=iso-8859-1');

// The language we are using

// The qls class will start the other classes
$qls = new qls(SYS_CURRENT_LANG);

02-23-2008, 07:57 AM
Pleaese I need it now.

the game hog
02-23-2008, 07:58 AM
the start session function has to be called before anything else or you will get the header error like you are receiving. Just slap it right after all your documentation and it should work fine :thumbsup:

02-23-2008, 08:01 AM
I put it at the verry top and still gives me the same error.

the game hog
02-23-2008, 08:06 AM
session start has to be called before any other information is outputted. That includes HTML. Also, I see one of your error messages is being called from your forums directory. Most forums today uses sessions instead of cookies that interact with a database by storing the unique session ID for the user in a database.
It may be that your forums are trying to create a session when you are already creating one and that is why it's saying that the headers were already sent. In that case, remove your session, but I don't get what you are trying to do here... build your own login from scratch or what? It has to be in one of the files that you are including, somewhere another session is starting or you have HTML in your file before the session start.

02-23-2008, 08:09 AM
Ok It's a session saying "Welcome Username" and I have to include "header.php" which is the code up there. I am including header.php in menu.php, menu.php is being included with index.php
so index.php has the includes of header and menu.php

SO the error is only on header.php. Edit that code UP above and give me the right one. Thanks

02-23-2008, 08:12 AM
Don't demand anything. We are helping on our own free time. As others have said you get the error when there is ANY output to the browser. How about posting a link to the page in question so we can see more information about your code.

02-23-2008, 08:14 AM
good idea.

02-23-2008, 08:33 AM
Before you start your sessions you have this

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Octi-Might Coding Store</title><style type="text/css">
.style1 {font-size: 24px}
.style2 {font-family: Verdana, Arial, Helvetica, sans-serif}
body,td,th {
color: #66CCFF;
a:link {
color: #66CCFF;
.style3 {font-weight: bold}

<style type="text/css">
body {
background-image: url(images/Untitled-5.jpg);
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
<br />
again NOTHING can before the session_starts() so move them above your html.

02-23-2008, 12:03 PM
Dfraz, the error message tells you where the output is occurring that is causing the problem - output started at ...index.php:5 The only thing to decode in that is the :5 means line 5.

02-23-2008, 05:28 PM
Hmm any body looked at the link recently?
its pretty much a smaller (a lot smaller) CF with help on wait for it...
yet he couldn't help his self, somewhat Ironic??