Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Odczytywanie chseł md5
tomek200
post 31.12.2014, 12:00:15
Post #1





Grupa: Zarejestrowani
Postów: 102
Pomógł: 4
Dołączył: 28.12.2014

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


  1. <?php
  2. function checkPass($user, $pass)
  3. {
  4.  
  5. if(!$fd = @fopen("passwords.txt", "r")) return false;
  6. while (!feof ($fd)){
  7. $line = trim(fgets($fd));
  8. if(($pos = strpos($line, ":"))===false) continue;
  9.  
  10. $tempUser = substr($line, 0, $pos);
  11. if($tempUser != $user) continue;
  12.  
  13. $tempPass = substr($line, $pos + 1, strlen($line) - $pos);
  14.  
  15. if($tempPass != $pass) continue;
  16. else{
  17. fclose($fd);
  18. return true;
  19. }
  20. }
  21. fclose($fd);
  22. return false;
  23. }
  24. if(!isSet($_POST["haslo"]) || !isSet($_POST["user"])){
  25. include('error.html');
  26. exit();
  27. }
  28. if(checkPass($_POST["user"], $_POST["haslo"])){
  29. $_SESSION["logged"] = true;
  30. include("index1.php");
  31. }
  32. else{
  33. include('error.html');
  34. }
  35. ?>

Jak dodać do tego kodu odczytywanie haseł zakodowanych w md5?

Ten post edytował tomek200 31.12.2014, 12:03:36
Go to the top of the page
+Quote Post

Posty w temacie
- tomek200   [PHP] Odczytywanie chseł md5   31.12.2014, 12:00:15
- - Turson   A co to jest chasło?   31.12.2014, 12:02:28
|- - Kshyhoo   Cytat(Turson @ 31.12.2014, 12:02:28 )...   31.12.2014, 16:21:28
- - Rysh   MD5 to nie kodowanie, tylko hashowanie. Kodowanie ...   31.12.2014, 12:09:24


Closed TopicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 07:16