jeudi 2 mars 2017

PHP if statement ignoring condition

I have this code in php, I want to check if the user is logged in ,and if he is I will show him the logout button instead of the login/register, at first i thought it was something wrong with my session variables or queries but even if the condition I set in the if statement is false, the Logout button still appears

      <?php if(1 == 2){ ?>
        <li><a href="sessionDestroy.php"><span class="glyphicon glyphicon-log-out"></span> Logout</a></li>              
     <?php } else{ ?>
        <li data-toggle="modal" data-target="#registerModal"><a href="#"><span class="glyphicon glyphicon-user"></span> Register</a></li>
        <li data-toggle="modal" data-target="#loginModal"><a href="#"><span class="glyphicon glyphicon-log-in"></span> Login</a></li>           
     <?php } ?>

For some reason, even if the condition I put in the if statement is false, the logout button will still appear in the page

Aucun commentaire:

Enregistrer un commentaire