proofing login success using sessions

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

 



Hello,

i have certain fields in a database including username and passwort.

The username and passwort are in the first two fields of the database.

Now, on the login page, i want to check the username and passwort
provided by the
user with the values in the database.

I have  the following code:

while($row = mysql_fetch_row($ergebnis)){

      if(($benutzername == $row[0]) && ($pass == $row[1])){
         echo '<p>Sie haben sich erfolgreich angemeldet.</p>';
         echo '<a href="willkommen.html">Willkommen</a>';
       }
       else if($benutzername != $row[0]){
         echo '<p>Fehler bei Anmeldung. Sie haben einen falschen
Benutzernamen eingegeben.</p>';
         die("Fehler bei Anmeldung");
       }
       else if($pass != $row[1]){
         echo '<p>Fehler bei Anmeldung. Sie haben ein falsches
Passwort eingegeben.</p>';
         die("Fehler bei Anmeldung");
       }
       else if(($benutzername != $row[0]) && ($pass != $row[1])){
         echo '<p>Fehler bei Anmeldung.</p>';
         die("Fehler bei Anmeldung");

       }

       else{
        echo '<p>Sie müssen sich mit Benutzernamen und Passwort anmelden.</p>';
       }
      }

The thing is that i use a loop to go through all rows in the database
and then compare the values
provided in the HTML form the ones standing in the database.

Since the user may provide wrong data i have these four scenarios.

The problem now is that i it dont gets into the first case - that is
username and passwort match.

I only get into cases two and three.

thank you.

Alexander

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux