Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> przypomnienie hasła użytkownikowi kłopot z kodem
cryptonim
post
Post #1





Grupa: Zarejestrowani
Postów: 16
Pomógł: 0
Dołączył: 30.05.2010

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


witam, mam kod służący przypomnienia użytkownikowi o jego haśle jeśli go zapomni,Wszystko działa prawidłowo tzn. dostaje wiadomość na maila itd, ale w miejscu gdzie ma być podane jego hasło jest luka i nie potrafię sobie z tym poradzić może wam się uda znależć rozwiązanie . oto kod:

  1.  
  2. <?
  3. include 'db.php';
  4.  
  5. switch($_POST['recover']){
  6. default:
  7. include 'lost_pw.html';
  8. break;
  9.  
  10. case "recover":
  11. recover_pw($_POST['email_address']);
  12. break;
  13. }
  14. function recover_pw($email_address){
  15. if(!$email_address){
  16. echo "You forgot to enter your Email address !!<br />";
  17. include 'lost_pw.html';
  18. exit();
  19. }
  20. // quick check to see if record exists
  21. $sql_check = mysql_query("SELECT * FROM users WHERE email_address='$email_address'");
  22. $sql_check_num = mysql_num_rows($sql_check);
  23. if($sql_check_num == 0){
  24. echo "No records found matching your email address<br />";
  25. include 'lost_pw.html';
  26. exit();
  27. }
  28. // Everything looks ok, update it and send it!
  29.  
  30.  
  31.  
  32. $db_password = md5($password);
  33.  
  34. $sql = mysql_query("UPDATE users SET password='$db_password' WHERE email_address='$email_address'");
  35.  
  36. $subject = "Your Password at MyWebsite!";
  37. $message = "Hi $first_name your username and password is.
  38.  
  39. Username:$username
  40. Password:$password
  41.  
  42. <a href="http://www.cos-tam.pl/login_form.html" target="_blank">http://www.cos-tam.pl/login_form.html</a>
  43.  
  44. Thanks!
  45. The Webmaster
  46.  
  47. This is an automated response, please do not reply!";
  48.  
  49. mail($email_address, $subject, $message, "From: costam<costam@o2.pl>\nX-Mailer: PHP/" . phpversion());
  50. include 'password.html';
  51. }
  52. ?>
  53.  
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: 17.09.2025 - 14:19