Web Analytics Made Easy -
StatCounter Why am i getting this error? - CodingForum

Announcement

Collapse
No announcement yet.

Why am i getting this error?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Why am i getting this error?

    // Check if session is not registered , redirect back to main page. // Put this code in first line of web page.
    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/dangmnne/public_html/hp/login_success.php:3) in /home/dangmnne/public_html/hp/login_success.php on line 4
    Login Successful

    the link is
    http://www.dangmn.net/hp/login_success.php

    the script is
    PHP Code:
    // Check if session is not registered , redirect back to main page.
    // Put this code in first line of web page.
    <?
    session_start
    ();
    if(!
    session_is_registered(myusername)){
    header("location:main_login.php");
    }
    ?>

    <html>
    <body>
    Login Successful
    </body>
    </html>

  • #2
    Just try deleting the part shown in red and see what happens:

    // Check if session is not registered , redirect back to main page.
    // Put this code in first line of web page.

    <?
    session_start();
    if(!session_is_registered(myusername)){
    header("location:main_login.php");
    }
    ?>

    <html>
    <body>
    Login Successful
    </body>
    </html>


    I think that's sending characters into the header buffer before the SESSION START, and you should not do that.


    .
    Last edited by mlseim; Apr 10, 2009, 08:30 PM.

    Comment


    • #3
      Originally posted by mlseim View Post
      Just try deleting the part shown in red and see what happens:

      // Check if session is not registered , redirect back to main page.
      // Put this code in first line of web page.

      <?
      session_start();
      if(!session_is_registered(myusername)){
      header("location:main_login.php");
      }
      ?>

      <html>
      <body>
      Login Successful
      </body>
      </html>


      I think that's sending characters into the header buffer before the SESSION START, and you should not do that.


      .
      yes you are right i got that 1 tobefore today

      you cant even have a linebreake like
      PHP Code:

      <? 
      session_start
      ();
      it has to be
      PHP Code:
      <? 
      session_start
      ();

      Comment


      • #4
        Originally posted by mlseim View Post
        Just try deleting the part shown in red and see what happens:

        // Check if session is not registered , redirect back to main page.
        // Put this code in first line of web page.

        <?
        session_start();
        if(!session_is_registered(myusername)){
        header("location:main_login.php");
        }
        ?>

        <html>
        <body>
        Login Successful
        </body>
        </html>


        I think that's sending characters into the header buffer before the SESSION START, and you should not do that.
        BTW // is only comment if it's in the <? tag.....

        Edit: Diload snuck in there...

        Comment


        • #5
          ...

          Comment

          Working...
          X