Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Siła hasła
kjiu
post
Post #1





Grupa: Zarejestrowani
Postów: 34
Pomógł: 0
Dołączył: 20.02.2009

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


Witam czy jest skrypt w php odnosnie siły hasła. ?


tak jak np https://www.google.com/accounts/NewAccount?service=mail&continue=http%3A%2F%2Fmail.google.com%2Fmail%2Fe-11-8fac6ac2093374b5046b378cc2558-ca46b5db2fd1dc9f6140122850bb4200ada71f7a&type=2
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
john_doe
post
Post #2





Grupa: Zarejestrowani
Postów: 873
Pomógł: 25
Dołączył: 24.07.2005

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


zobacz sobie coś takiego prostego w JS

  1. function passCounter()
  2. {
  3. counterDiv = document.getElementById('counter');
  4. var passLength = 8 - document.loginForm.newPass.value.length;
  5.  
  6. counterDiv.innerHTML = "<b style='font-size: 9px;'>" + passLength + "</b>";
  7.  
  8. for (var i = 1 ; i <= document.loginForm.newPass.value.length ; i++)
  9. {
  10. counterDiv.innerHTML += "<img src='images/passDot.JPG' />";
  11. }
  12.  
  13. if ( passLength <= 0 )
  14. {
  15. counterDiv.innerHTML = "<b style='color: #99cc33; font-size: 10px;'>Wpisane hasło ma odpowiednią długość!</b>";
  16. }
  17. }
  18.  
  19. function checkPassConfirmation()
  20. {
  21. var newPass = document.loginForm.newPass.value;
  22. var pasConfirm = document.loginForm.newPassConfirm.value;
  23.  
  24. if ( newPass != pasConfirm )
  25. {
  26. document.getElementById('confirmation').innerHTML = "<b style='color: red; font-size: 10px;'>Potwiedzenie nowego hasła jest inne!</b>";
  27. document.loginForm.mySub.disabled = true;
  28. }else {
  29. document.getElementById('confirmation').innerHTML = "<b style='color: #99cc33; font-size: 10px;'>Potwiedzenie OK!</b>";
  30. document.loginForm.mySub.disabled = false;
  31. }
  32. }


potem użyj sobie tego np

  1. <form name="loginForm" method="POST" action="chgPass.php" >
  2.  
  3. <input class="loginInput" type="password" name="newPass" maxlength="15" onKeyUp="passCounter();" />
  4. <div id="counter"></div>
  5.  
  6. <input class="loginInput" type="password" name="newPassConfirm" maxlength="15" onKeyUp="checkPassConfirmation();" />
  7. <div id="confirmation"></div>
  8. // tutaj jakiś sumbit
  9. </form>


zobacz

Ten post edytował john_doe 4.11.2009, 08:48:43
Go to the top of the page
+Quote Post
Spirit86
post
Post #3





Grupa: Zarejestrowani
Postów: 607
Pomógł: 23
Dołączył: 8.09.2004
Skąd: Wrocław

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


Cytat(john_doe @ 4.11.2009, 08:47:29 ) *
zobacz sobie coś takiego prostego w JS

  1. function passCounter()
  2. {
  3. counterDiv = document.getElementById('counter');
  4. var passLength = 8 - document.loginForm.newPass.value.length;
  5.  
  6. counterDiv.innerHTML = "<b style='font-size: 9px;'>" + passLength + "</b>";
  7.  
  8. for (var i = 1 ; i <= document.loginForm.newPass.value.length ; i++)
  9. {
  10. counterDiv.innerHTML += "<img src='images/passDot.JPG' />";
  11. }
  12.  
  13. if ( passLength <= 0 )
  14. {
  15. counterDiv.innerHTML = "<b style='color: #99cc33; font-size: 10px;'>Wpisane hasło ma odpowiednią długość!</b>";
  16. }
  17. }
  18.  
  19. function checkPassConfirmation()
  20. {
  21. var newPass = document.loginForm.newPass.value;
  22. var pasConfirm = document.loginForm.newPassConfirm.value;
  23.  
  24. if ( newPass != pasConfirm )
  25. {
  26. document.getElementById('confirmation').innerHTML = "<b style='color: red; font-size: 10px;'>Potwiedzenie nowego hasła jest inne!</b>";
  27. document.loginForm.mySub.disabled = true;
  28. }else {
  29. document.getElementById('confirmation').innerHTML = "<b style='color: #99cc33; font-size: 10px;'>Potwiedzenie OK!</b>";
  30. document.loginForm.mySub.disabled = false;
  31. }
  32. }


potem użyj sobie tego np

  1. <form name="loginForm" method="POST" action="chgPass.php" >
  2.  
  3. <input class="loginInput" type="password" name="newPass" maxlength="15" onKeyUp="passCounter();" />
  4. <div id="counter"></div>
  5.  
  6. <input class="loginInput" type="password" name="newPassConfirm" maxlength="15" onKeyUp="checkPassConfirmation();" />
  7. <div id="confirmation"></div>
  8. // tutaj jakiś sumbit
  9. </form>


zobacz


to nie jest sprawdzanie siły hasła...

1) sprawdzasz czy hasło nie jest takie samo jak login
2) długość hasła >6 znaków
3) hasła:
Kod
same litery proste
jak występują cyfry, litery hasło słabe
cyfry; duże, małe litery - średnie
cyfry; duże, małe litery, znaki specjalne - mocne
cyfry; duże, małe litery, znaki specjalne, długie (załóżmy >9 znaków) - silne

no i tak powinieneś kombinować

pozdro
Go to the top of the page
+Quote Post

Posty w temacie


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 Aktualny czas: 4.10.2025 - 00:20