Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Logowanie
Hectic
post
Post #1





Grupa: Zarejestrowani
Postów: 256
Pomógł: 7
Dołączył: 1.01.2005

Ostrzeżenie: (0%)
-----


Czy może mi ktoś powiedzieć czy jest to poprawny kod funkcji logowania?

  1. <?
  2. $login=$_POST['login'];
  3. $password = md5($_POST['password']);
  4.  
  5. $result = mysql_query ("SELECT password FROM `admin` WHERE login = '$login' "); // pobranie hasła do podanego loginu
  6. $pas = mysql_fetch_array($result);
  7.  
  8.  
  9.  
  10. <form method="post">
  11. <table border="0" cellspacing="0" cellpadding="0">
  12. <tr>
  13. <td height="5"></TD>
  14. </tr>
  15. <tr>
  16. <td>Login: </td>
  17. <td width="5"></td>
  18. <td colspan="2"><input type="Text" name="login"></td>
  19. </tr>
  20. <tr>
  21. <td height="5"></TD>
  22. </tr>
  23. <tr>
  24. <td>Hasło: </td>
  25. <td width="5"></td>
  26. <td><input type="password" name="password"></td>
  27. </tr>
  28. <tr>
  29. <td height="5"></TD>
  30. </tr>
  31. <tr>
  32. <td colspan="3" align="center"><input type="Submit" name="submit" value="Wyślij"></td>
  33. </tr>
  34. </table></form>';
  35.  
  36. if ($password == $pas['password'])
  37.  
  38. echo'Hasło ok';
  39.  
  40. else 
  41.  
  42. echo 'Złe hasło';
  43. ?>


////Edit

hasło jest kodowane w MD5 tongue.gif

Ten post edytował Hectic 1.03.2006, 15:03:45


--------------------
Nie proś o to, idź i sam to zdobądź.
Zrób to, a osiągniesz sukces.
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 03:03