SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: is this seriuse

  1. #1
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    is this seriuse

    i want to know if this is seruise problem.

    Warning: Cannot modify header information - headers already sent by
    Notice: A session had already been started - ignoring session_start()


    and if its seriuse how to fix it?


    thanks
    Never be shy to ask silly Qs
    An answer is always better than none

  2. #2
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Earth
    Posts
    739
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    <?php ob_start(); ?>

    at the top of yer page(s) will stop the headers allready sent problem.


    hth

  3. #3
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cool it fixed the problem thanks

    but what about the session

    Notice: A session had already been started - ignoring session_start()
    Never be shy to ask silly Qs
    An answer is always better than none

  4. #4
    SitePoint Zealot
    Join Date
    Mar 2006
    Posts
    190
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you trying to redirect your visitors to a different page?

  5. #5
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if the condition have not met yes

    if the condition met continue
    ob_start();
    session_start();
    header("Cache-control: private");
    if((!isset ($_SESSION["myusername"])))
    header("Location: login.php");
    Never be shy to ask silly Qs
    An answer is always better than none

  6. #6
    Obey the Purebreed trib4lmaniac's Avatar
    Join Date
    Dec 2004
    Location
    Cornwall, UK
    Posts
    594
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The first error is because you have sent a header after you have started your output. This is solved with either output buffers (as you've done), or - as is more preferable - by simply moving session_start() to the very top of your script.

    The second error means that session_start() has been called twice, the second is obviously superfluous and should be scrapped.
    PHP may be configured to start a session automatically, in which case you can use the following:
    PHP Code:
    if(!ini_get('session.auto_start')) {
        
    session_start();



Bookmarks

Posting Permissions

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