aktell Posted February 13, 2007 Share Posted February 13, 2007 Hi there, I'm doing code out of a book to learn and I have a small problem ! My app. is working perfectly well, just as I go through it at some stage there is a msg comming up, and that on several pages which use the session id. I like to mention that the page shows perfectly well, just on top this msg. Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/../../../auth_user.inc.php:2) in /home/../..//auth_user.inc.php on line 3 The session code is below: On a Php page called auth_userinc.php. <? session_start(); if ($_SESSION['user_logged'] == "" || $_SESSION['user_password'] == "") { $redirect = $_SERVER['PHP_SELF']; header("Refresh: 5; URL=user_login.php?redirect=$redirect"); echo "You are currently not logged in, we are redirecting you, be patient!<br>"; echo "(If your browser doesn't support this, <a href=\"user_login.php?redirect=$redirect\">click here</a>)"; die(); } else {} ?> Thanks in advance aktell Quote Link to comment Share on other sites More sharing options...
trq Posted February 13, 2007 Share Posted February 13, 2007 Have your read the HEADER ERRORS sticky at the top of this forum? Quote Link to comment Share on other sites More sharing options...
marcus Posted February 13, 2007 Share Posted February 13, 2007 In PHP the session_start(); header must be the first line after the <?php tag. Meaning if it's included on another file it must be the first line. <?php session_start(); //remove that from that file include('auth_userinc.php'); ?> Quote Link to comment Share on other sites More sharing options...
aktell Posted February 14, 2007 Author Share Posted February 14, 2007 In PHP the session_start(); header must be the first line after the <?php tag. Meaning if it's included on another file it must be the first line. <?php session_start(); //remove that from that file include('auth_userinc.php'); ?> Hi there, Thanks alot, I found that the Session was not included in two pages and the one was as you said I got them working. Thanks again aktell Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.