Supportnet Computer
Planet of Tech

Supportnet / Forum / Skripte(PHP,ASP,Perl...)

Login-Script geht nicht





Frage

Hiho, ich hab ein Login-Script mit MySQL gemacht. Leider geht es nicht und ich finde keinen Fehler. [code] <form action="<?=$PHP_SELF?>" method="POST"> <table align="center" border="0"> <tr> <th> Username: </th> <th> <input type="text" name="username"> </th> </tr> <tr> <th> Password: </th> <th> <input type="password" name="password"> </th> </tr> <tr> <th colspan="2" align="right"> <input type="submit" value="Login"> </form> </th> </tr> </table> <? $db = "db29070201"; $link = mysql_connect("62.146.144.2","user","pass"); mysql_select_db($db,$link); $sql = mysql_query("SELECT passwort FROM members WHERE nick = '$username'"); $fetch_em = mysql_fetch_array($sql); $numrows = mysql_num_rows($sql); if($numrows != "0" & $password == $fetch_em["password"]) { echo("falsch"); } else { echo("richtig"); } ?> <form action="<?=$PHP_SELF?>" method="POST"> <table align="center" border="0"> <tr> <th> Username: </th> <th> <input type="text" name="username"> </th> </tr> <tr> <th> Password: </th> <th> <input type="password" name="password"> </th> </tr> <tr> <th colspan="2" align="right"> <input type="submit" value="Login"> </form> </th> </tr> </table> [/code] Es wird immer "richtig" ausgegeben, selbst wenn der Username bzw. das Passwort falsch ist. Woran liegt es?

Antwort 1 von semi

Statt $username $_POST['username']
Statt $PHP_SELF $_SERVER['PHP_SELF']

Der Rest genauso.

Ich möchte kostenlos eine Frage an die Mitglieder stellen:


Ähnliche Themen:


Suche in allen vorhandenen Beiträgen: