Zrobiłem taki skrypt i mogę zalogować się tylko na usera który jest na pierwszym miejscu w bazie danych... i nie wiem co mam robić...
<?
require_once "config.php";
$sql="SELECT * FROM user";
if(!$haslo) { // jeżeli nie zostało wpisane hasło wczytujemy formularz do jego wpisania
print "<center>To jest prywatna część strony, wymagane jest hasło:</center><br>"; print "<center><form method=post action=index.php></center>"; print "<center><input type=text name=login></center><br>"; print "<center><input type=password name=haslo></center><br>"; print "<center><input type=submit name=loguj value=loguj></center></form>";
} else if($action=='wyloguj') { // skrypt odpowiedzialny za wylogowanie z systemu
print "<center>Zostałeś pomyślnie wylogowany</center>"; print "<center><form method=post action=index.php></center>"; print "<center><input type=text name=login></center><br>"; print "<center><input type=password name=haslo></center><br>"; print "<center><input type=submit name=loguj value=loguj></center></form>";
} else if($haslo==$linia[pass] && $login==$linia[login]) { // sprawdza czy hasło jest poprawne
echo 'Jesteś zalogowany jako: '.$linia[nick
].'<br>'; echo '<a href="index.php?action=wyloguj">Wyloguj</a><br>';
} else { // wyświetla komunikat jeżeli wpisane hasło jest błędne
print "<center>Błędne hasło!!!</center>"; print "<center><form method=post action=index.php></center>"; print "<center><input type=text name=login></center><br>"; print "<center><input type=password name=haslo></center><br>"; print "<center><input type=submit name=loguj value=loguj></center></form>"; }
?>