lundi 22 juin 2015

Curious behavior of if

if(isset($_SESSION['loginversuche'])and (int)$_SESSION['loginversuche']>1 and $_SESSION['loginversuche']<= $maxanzahlloginversuche)
        $loginstatus=$_SESSION['loginversuche']-1;
            {     echo "Test".$_SESSION['loginversuche']." - ".$maxanzahlloginversuche;
            $_SESSION['fehler']='Das war Ihr '.$loginstatus.'. Logixxxxxxxxxnversuch. Nach dem '.$maxanzahlloginversuche.'. fehlerhaften Login wird Ihr Konto bzw. Ihre Ip-Adresse ('.$_SERVER['REMOTE_ADDR'].') gesperrt.' ;       
echo '<tr><td class="datenzelle2" colspan="2"><strong>'.$_SESSION['fehler'].'</strong></td></tr>';        
if($_SESSION['loginversuche']>=$maxanzahlloginversuche)
{
//  unset($_SESSION['loginversuche']);
 unset($_SESSION['fehler']);
 }

> What is curious? I first asked, if the Session loginversuche is greater than 1, but smaller than $maxanzahllogginversuche. The code within the "if" is executed, so the condition is true. But, when ging out the actual values of the Session Loginversuche and $maxanzahlloginversuche, it gives out the expected values. The session has 1 and the maxanzahlloginnversuche has 5. And 1 is obviously not greater than 1. I thought it might be a problem with the 1 in the session and it might be interpreted as a string, which caueses the error. Like "a" is greater than "1". But no change. any idea?

Aucun commentaire:

Enregistrer un commentaire