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 (IMG:http://forum.php.pl/style_emoticons/default/tongue.gif)

Ten post edytował Hectic 1.03.2006, 15:03:45
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
nospor
post
Post #2





Grupa: Moderatorzy
Postów: 36 559
Pomógł: 6315
Dołączył: 27.12.2004




zapoznaj sie z tym tematem, a zobaczysz co masz nie tak:
http://forum.php.pl/index.php?showtopic=23258&st=0

te tez ci sie przydadzą:
http://forum.php.pl/index.php?showtopic=30056
no i ten tez moze:
http://forum.php.pl/index.php?showtopic=42668&st=0

Cytat
////Edit

hasło jest kodowane w MD5
(IMG:http://forum.php.pl/style_emoticons/default/laugh.gif) dzieki za cynk (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg)
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 3.10.2025 - 20:16