Okay...so...my first question on here, please bear with me.
I have made a login script with registration, MySQL database, etc. So far it is working great. Except for the fact that when I refresh the page, even if I have not entered any information yet, it gives me the incorrect login information error. First time Loading the page, or if i log into a fake user, then log out, it will work. But Here is the code
if($_SESSION["logged"])
{
print_secure_content();
}
else {
if(!$_SESSION["logging"])
{
$_SESSION["logging"]=true;
echo "Login:";
loginform();
}
else if($_SESSION["logging"])
{
$number_of_rows=checkpass();
if($number_of_rows==1)
{
$_SESSION[user]=$_POST[userlogin];
$_SESSION[logged]=true;
echo"<h1>you have logged in successfully</h1>";
print_secure_content();
}
else{
echo "wrong password or username, please try again";
loginform();
}
}
}