Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Problem z zmianą hasła
Otto
post 20.10.2010, 16:36:01
Post #1





Grupa: Zarejestrowani
Postów: 144
Pomógł: 7
Dołączył: 22.03.2010

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


Witam mam taki irytujący problem z zmianą hasła... Mianowicie mam hasło kodowane w md5 jednak md5 koduje tez pustą zmienną i przez to nie mogę zrobić by gdy stare hasło, nowe hasło oraz powtórzone nowe hasło nie zostanie podane nie zmienni hasła...
  1.  
  2. $o_pass = $r['pass'];
  3. $n_pass = md5($haslo0);
  4.  
  5. if (empty($haslo0) && empty($haslo1) && empty($haslo2)) {
  6. $haslo = $o_pass;
  7. } else {
  8.  
  9. if (!empty($haslo0)) {
  10. if ($n_pass != $o_pass) {
  11. die(header('location:/edytuj_profil.php?error=2'));
  12. }
  13. if (empty($haslo1) || empty($haslo2)) {
  14. die(header('location:/edytuj_profil.php?error=7'));
  15. }
  16.  
  17. if ($haslo1 != $haslo2) {
  18. die(header('location:/edytuj_profil.php?error=8'));
  19. }
  20. }
  21. }


Ten post edytował Otto 20.10.2010, 16:37:06
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
tehaha
post 20.10.2010, 16:41:55
Post #2





Grupa: Zarejestrowani
Postów: 1 748
Pomógł: 388
Dołączył: 21.08.2009
Skąd: Gdynia

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


no to zanim zakodujesz md5() , obetnij spacje trim() / rtrim() i sprawdź czy zmienna nie jest pusta
Go to the top of the page
+Quote Post
Otto
post 20.10.2010, 16:48:35
Post #3





Grupa: Zarejestrowani
Postów: 144
Pomógł: 7
Dołączył: 22.03.2010

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


...


  1.  
  2. $haslo0 = trim($_POST['haslo0']);
  3. $haslo1 = trim($_POST['haslo1']);
  4. $haslo2 = trim($_POST['haslo2']);
  5.  
  6. $o_pass = $r['pass'];
  7. $n_pass = md5($haslo0);
  8.  
  9. if (empty($haslo0) && empty($haslo1) && empty($haslo2)) {
  10. $haslo = $o_pass;
  11. } else {
  12.  
  13. if (!empty($haslo0)) {
  14. if ($n_pass != $o_pass) {
  15. die(header('location:/edytuj_profil.php?error=2'));
  16. }
  17. if (empty($haslo1) || empty($haslo2)) {
  18. die(header('location:/edytuj_profil.php?error=7'));
  19. }
  20.  
  21. if ($haslo1 != $haslo2) {
  22. die(header('location:/edytuj_profil.php?error=8'));
  23. }
  24. }
  25. }
  26.  


Sprawdzało cały czas czy hasło jest puste czy nie... Już działa po prostu zapomniałem dać odpowiednią zmienna w UPDATE
Go to the top of the page
+Quote Post

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 Wersja Lo-Fi Aktualny czas: 19.07.2025 - 06:55