Else statement for Login Function not Always Working Correctly
<p>The code below is part of a PHP / MySQL login system that I am using.  It determines whether or not the login fields are displayed, and it is supposed to only display them when the user is not logged in.  Sometimes it displays them when is user is logged in, logging the user out.  </p>

<p>Any ideas on what I should look for to trouble shoot this?</p>

<p>Thanks in advance,</p>

<p>John</p>

<pre><code>&lt;?php
if (!isLoggedIn())
{

    if (isset($_POST['cmdlogin']))
    {

        if (checkLogin($_POST['username'], $_POST['password']))
        {
            show_userbox();

        } else
        {
            echo "Incorrect Login information !";
            show_loginform();
        }
    } else
    {

        show_loginform();
    }

} else
{

    show_userbox();

}

?&gt;
</code></pre>
