Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11

Thread: Session stuff

  1. #1
    Banned
    Join Date
    Feb 2008
    Location
    USA
    Posts
    61
    Thanks
    15
    Thanked 1 Time in 1 Post

    Session stuff

    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:

    PHP Code:
    <?php
    /*** *** *** *** *** ***
    * @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
    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * 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')) {
    exit;
    }

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

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

    // The language we are using
    require_once('Blank.lang.php');

    // The qls class will start the other classes
    require_once('qls.class.php');
    $qls = new qls(SYS_CURRENT_LANG);
    ?>

  • #2
    Banned
    Join Date
    Feb 2008
    Location
    USA
    Posts
    61
    Thanks
    15
    Thanked 1 Time in 1 Post
    Pleaese I need it now.

  • #3
    New Coder
    Join Date
    Oct 2007
    Location
    Irwin, PA
    Posts
    23
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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

  • #4
    Banned
    Join Date
    Feb 2008
    Location
    USA
    Posts
    61
    Thanks
    15
    Thanked 1 Time in 1 Post
    I put it at the verry top and still gives me the same error.

  • #5
    New Coder
    Join Date
    Oct 2007
    Location
    Irwin, PA
    Posts
    23
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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.

  • #6
    Banned
    Join Date
    Feb 2008
    Location
    USA
    Posts
    61
    Thanks
    15
    Thanked 1 Time in 1 Post
    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

  • #7
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    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.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #8
    Banned
    Join Date
    Feb 2008
    Location
    USA
    Posts
    61
    Thanks
    15
    Thanked 1 Time in 1 Post

  • #9
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Before you start your sessions you have this
    Code:
    <!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">
    <head>
    <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></head>
    
    <body>
    <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.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #10
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,027
    Thanks
    2
    Thanked 315 Times in 307 Posts
    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.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #11
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    Hmm any body looked at the link recently?
    its pretty much a smaller (a lot smaller) CF with help on wait for it...
    PHP.
    yet he couldn't help his self, somewhat Ironic??
    Last edited by rafiki; 02-23-2008 at 04:28 PM. Reason: Typo


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •