Re: Warning: session_start()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I see.
So I moved session_start() to the beginning of the html script, and included
an output buffer. It looks like this:

<?php
ob_start(ob_gzhandler);  //starts output buffer, compresses HTML
session_start();
?>

<html>
    <head>
         . . .



Then, in login_form.php (which is included on this index page), I deleted
session_start() since it is initiated at the start of the html script (and
produced error messages when it was in the middle of the conditional
statement):

    if($login && $password)
    {
        if (mysql_num_rows($check_login))
        {
           // session_start();
            $_SESSION ['login'] = $data['login'];

             echo '<script
language="javascript">location.href="first_page.php"</script>';

             exit;
        }


It seems to work: the page redirects upon logging in, there's no error
message, the session seems to be remembered.

Thanks so much for the coding tips. They were extremely useful!!

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux