MaxRom | Scripturi uCoz Romania

Bannerul tau aici
[ Mesaje noi · Membrii · Regulamentul forumului · RSS ]
  • Pagina 1 din 1
  • 1
Forum » Gunoi » Gunoi şi alte prostii » Nivelul de securitatea a parolei la înregistrare
Nivelul de securitatea a parolei la înregistrare
Muşatinu Date: Vineri, 2009-10-23, 18:56 | Message # 1
Mesaje: 1801
Awards: 202
« 53 »

După <?if($PASSWORD_FL$)?> din User registration form adăugăm următorul cod:

Code
<div id="mypassword_text" style="display:inline;"></div>       
<div id="mypassword_bar" style="font-size: 1px; height: 3px; width: 0px; "></div></td></tr><SCRIPT type="text/javascript"> var m_strUpperCase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_"; var m_strLowerCase = "abcdefghijklmnopqrstuvwxyz-"; var m_strNumber = "0123456789"; function checkPassword(strPassword) { var nScore = 0; if (strPassword.length < 6) { nScore += 0; } else if (strPassword.length > 5 && strPassword.length < 10) { nScore += 11; } else if (strPassword.length > 9) { nScore += 33; } var nUpperCount = countContain(strPassword, m_strUpperCase); var nLowerCount = countContain(strPassword, m_strLowerCase); var nLowerUpperCount = nUpperCount + nLowerCount; if (nUpperCount == 0 && nLowerCount != 0) { nScore += 10; } else if (nUpperCount != 0 && nLowerCount == 0) { nScore += 10; } else if (nUpperCount != 0 && nLowerCount != 0) { nScore += 26; } var nNumberCount = countContain(strPassword, m_strNumber); if (nNumberCount >= 2) { nScore += 10; } if (nNumberCount >= 4) { nScore += 26; } if (nNumberCount != 0 && nLowerUpperCount != 0) { nScore += 5; } return nScore; } function runPassword(strPassword, strFieldID) { var nScore = checkPassword(strPassword); var ctlBar = document.getElementById(strFieldID + "_bar"); var ctlText = document.getElementById(strFieldID + "_text"); if (!ctlBar || !ctlText) return; ctlBar.style.width = nScore + "%"; if (nScore == 100) { var strText = "Securitate foarte înaltă"; var strColor = "limegreen"; } else if (nScore >= 80) { var strText = "Securitate înaltă"; var strColor = "blue"; } else if (nScore >= 65) { var strText = "Securitate medie"; var strColor = "dodgerblue"; } else if (nScore >= 50) { var strText = "Securitate joasă"; var strColor = "mediumturquoise"; } else if (nScore >= 25) { var strText = "Securitate foarte joasă"; var strColor = "yellowgreen"; } else if (nScore != 0) { var strText = "Să nu te plângi că ai fost spart"; var strColor = "firebrick"; } else { var strText = ""; var strColor = "black"; } ctlBar.style.backgroundColor = strColor; ctlText.innerHTML = "<span style='color: " + strColor + ";'> " + strText + " - " + nScore + "%</span>"; } function countContain(strPassword, strCheck) { var nCount = 0; for (i = 0; i < strPassword.length; i++) { if (strCheck.indexOf(strPassword.charAt(i)) > -1) { nCount++; } } return nCount; } document.getElementById("siF14").onkeyup="runPassword(this.value, 'mypassword')"; </SCRIPT>



 
Horatiu Date: Sâmbătă, 2009-10-24, 08:40 | Message # 2
Mesaje: 42
Awards: 0
« 0 »

adica?


Dragutz cu cei ce ma respecta :)
 
Muşatinu Date: Sâmbătă, 2009-10-24, 09:53 | Message # 3
Mesaje: 1801
Awards: 202
« 53 »

Horatiu, Va arata cat de bun este parola...



 
Forum » Gunoi » Gunoi şi alte prostii » Nivelul de securitatea a parolei la înregistrare
  • Pagina 1 din 1
  • 1
Căutare: