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 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2009
    Posts
    74
    Thanks
    2
    Thanked 0 Times in 0 Posts

    PHP function Session_start() problem

    i am facing the following problem but i am not understanding how can i solve this problem.
    i have a page named writeblog.php where without login access is denied.the code is as follows
    Code:
    3.session_start();
    4.if (!isset($_SESSION['username']))
    {
          header('Location:index.php?redirection=' . urlencode($_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']) );
          exit;
    
    }
    
    when i go this page the following warning is occured
    
    Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at D:\wamp\www\blog\Readblog.php:2) in D:\wamp\www\blog\Readblog.php on line 4
    
    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\wamp\www\blog\Readblog.php:2) in D:\wamp\www\blog\Readblog.php on line 4
    please help me out
    
    include('prac.php');
    
    
    
    ?>

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,853
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Check the notes in the manual of session_start()
    Note: If you are using cookie-based sessions, you must call session_start() before anything is outputted to the browser.
    Reading http://www.codingforums.com/showthre...877#post300877 might also help.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

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