Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [php] Logowanie + MD5
kixner
post
Post #1





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 27.12.2006

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


Witam!
Mam nastepujacy kod w pliku zaloguj.php:
  1. <?php
  2.  
  3. if($_POST['user'] == "" || $_POST['pass'] == "")
  4. {
  5. ?>
  6. <form name="logowanie" action="zaloguj.php" method="POST">
  7. Login: <input type="text" name="user" /><br />
  8. Hasło: <input type="password" name="pass" /><br />
  9. <input type="submit" name="submit" value="Zaloguj" />
  10. </form>
  11. <?php
  12. }
  13. else
  14. {
  15.  $file = file("users.dat");
  16.  foreach($file as $userdata)
  17.  {
  18. list($login, $haslo, $redirect) = explode("||", $userdata);
  19. if($login == $_POST['user'] && $haslo == $_POST['pass'])
  20. {
  21.  $_SESSION['username'] = $_POST['user'];
  22.  $_SESSION['user_logged'] = time();
  23.  $_SESSION['redirect'] = "/" . $redirect;
  24.  
  25.  header("Location: " . $redirect);
  26. }
  27.  }
  28. }
  29. ?>

Plik users.dat ma postac:
  1. crash||haslo||strona_docelowa.php
  2. user||pass||homepage.php
  3. lolek||lolus||lolek_page.php

No i moj problem jest taki ze nie wiem jak zrobic zeby haslo w pliku users.dat bylo zaszyfrowane w md5... Prosze o pomoc i z gory dziekuje.

Ten post edytował kixner 27.12.2006, 15:46:21
Go to the top of the page
+Quote Post
revyag
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 2 258
Pomógł: 16
Dołączył: 21.09.2004
Skąd: Kielce

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


Wpisz sobie (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

wyświetl sobie w przeglądarce:
  1. <?php
  2. echo md5('haslo');
  3. ?>


przenoszę na przedszkole
Go to the top of the page
+Quote Post
kixner
post
Post #3





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 27.12.2006

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


Dzieki!!! Naprowadzilo mnie to i zmodyfikowalem odpowiednio kod i dziala (IMG:http://forum.php.pl/style_emoticons/default/tongue.gif) . Jeszcze raz bardzo dziekuje.
Go to the top of the page
+Quote Post

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: 5.10.2025 - 06:24