Dynamic Password Checker?

Σε αυτή την περιοχή μπορείτε να βρείτε ή να αναζητήσετε πληροφορίες σχετικές με την PHP

Συντονιστές: WebDev Moderators, Super-Moderators, PHP Moderators

Απάντηση
Άβαταρ μέλους
GRaecuS
Δημοσιεύσεις: 113
Εγγραφή: 02 Απρ 2003 10:21
Τοποθεσία: Thessaloniki
Επικοινωνία:

Dynamic Password Checker?

Δημοσίευση από GRaecuS » 14 Ιουν 2007 15:19

Θα ήθελα να εισάγω στην ιστοσελίδα μου ένα scriptaki που να ελέγχει σε real time το κατα πόσο ισχυρό είναι το password.

Κάτι σαν αυτό: https://www.xing.com/app/register?op=login_data

Υπάρχει κάτι έτοιμο?

Άβαταρ μέλους
Khronos
Δημοσιεύσεις: 754
Εγγραφή: 11 Δεκ 2006 14:43
Τοποθεσία: Ηράκλειο

Dynamic Password Checker?

Δημοσίευση από Khronos » 14 Ιουν 2007 18:57

Βρήκα αυτό:

Κώδικας: Επιλογή όλων

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http&#58;//www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>LCDG password checker</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<td><style>
.special &#123;
font-family&#58; Tahoma, Verdana, "Trebuchet MS";
font-size&#58; 11px;
color&#58; #993366;
&#125;
.style1 &#123;color&#58; #FFFFFF&#125;
.style2 &#123;
	font-family&#58; Verdana, Arial, Helvetica, sans-serif;
	font-size&#58; small;
&#125;
.style3 &#123;font-family&#58; Verdana, Arial, Helvetica, sans-serif&#125;
</style>

<script language="javascript">
var ieDOM = false, nsDOM = false;
var stdDOM = document.getElementById; function initMethod&#40;&#41;
&#123;
//Determine the browser support for the DOM
if&#40; !stdDOM &#41;

&#123;
ieDOM = document.all;
if&#40; !ieDOM &#41;

&#123;
nsDOM = &#40;&#40;navigator.appName.indexOf&#40;'Netscape'&#41; != -1&#41; && &#40;parseInt&#40;navigator.appVersion&#41; ==4&#41;&#41;;
&#125;
&#125;

passwordChanged&#40;&#41;;
&#125;
function getObject&#40;objectId&#41;

&#123;
if &#40;stdDOM&#41; return document.getElementById&#40;objectId&#41;;
if &#40;ieDOM&#41; return document.all&#91;objectId&#93;;
if &#40;nsDOM&#41; return document.layers&#91;objectId&#93;;
&#125;
function getObjectStyle&#40;objectId&#41;

&#123;
if &#40;nsDOM&#41; return getObject&#40;objectId&#41;;
var obj = getObject&#40;objectId&#41;;

return obj.style;
&#125;
function showDefault&#40;objectId&#41;

&#123;
showCell&#40;objectId, "#E2E2E2", "#E2E2E2"&#41;;
&#125;
function showCell&#40;objectId, foreColor, backColor&#41;
&#123;
getObjectStyle&#40;objectId&#41;.color = foreColor;

getObjectStyle&#40;objectId&#41;.backgroundColor = backColor;
&#125;
function showWeak&#40;&#41;

&#123;
showCell&#40;"pwWeak", "Black", "#FF6666"&#41;;
showDefault&#40;"pwMedium"&#41;;

showDefault&#40;"pwStrong"&#41;;
&#125;
function showMedium&#40;&#41;

&#123;
showCell&#40;"pwWeak", "#FFCC66", "#FFCC66"&#41;;
showCell&#40;"pwMedium", "Black", "#FFCC66"&#41;;

showDefault&#40;"pwStrong"&#41;;
&#125;
function showStrong&#40;&#41;

&#123;
showCell&#40;"pwWeak", "#80FF80", "#80FF80"&#41;;
showCell&#40;"pwMedium", "#80FF80", "#80FF80"&#41;;
showCell&#40;"pwStrong", "Black", "#80FF80"&#41;;
&#125;
function showUndetermined&#40;&#41;

&#123;
showDefault&#40;"pwWeak"&#41;;
showDefault&#40;"pwMedium"&#41;;
showDefault&#40;"pwStrong"&#41;;
&#125;


function passwordChanged&#40;&#41;
&#123;
var strongRegex = new RegExp&#40;"^&#40;?=.&#123;8,&#125;&#41;&#40;?=.*&#91;A-Z&#93;&#41;&#40;?=.*&#91;a-z&#93;&#41;&#40;?=.*&#91;0-9&#93;&#41;&#40;?=.*\\W&#41;.*$", "g"&#41;;
var mediumRegex = new RegExp&#40;"^&#40;?=.&#123;7,&#125;&#41;&#40;&#40;&#40;?=.*&#91;A-Z&#93;&#41;&#40;?=.*&#91;a-z&#93;&#41;&#41;|&#40;&#40;?=.*&#91;A-Z&#93;&#41;&#40;?=.*&#91;0-9&#93;&#41;&#41;|&#40;&#40;?=.*&#91;a-z&#93;&#41;&#40;?=.*&#91;0-9&#93;&#41;&#41;&#41;.*$", "g"&#41;;
var enoughRegex = new RegExp&#40;"&#40;?=.&#123;4,&#125;&#41;.*", "g"&#41;;


var pwd = getObject&#40;"txtPassword"&#41;.value;
if&#40; false == enoughRegex.test&#40;pwd&#41; &#41;
&#123;
showUndetermined&#40;&#41;;
&#125;
else if&#40; strongRegex.test&#40;pwd&#41; &#41;
&#123;
showStrong&#40;&#41;;
&#125;
else if&#40; mediumRegex.test&#40; pwd &#41; &#41;
&#123;
showMedium&#40;&#41;;
&#125;
else
&#123;
showWeak&#40;&#41;;
&#125;
&#125;

function clearBox&#40;box&#41; &#123;
	 if&#40;box.value==box.defaultValue&#41; &#123;
		 box.value = "";
	 &#125;
 &#125;
function fillBox&#40;box&#41; &#123;
	 if&#40;box.value==""&#41; &#123;
		 box.value=box.defaultValue;
	 &#125;
&#125;
</script>
<div style="background-image&#58;url&#40;../images/logofaded15.gif&#41;; background-repeat&#58;no-repeat;">
<h1 align="left">Password Strength Checker </h1>

<TABLE width="140" cellPadding="0"cellSpacing="0" class="special" >
<TR>
<TD align="center" id="pwWeak">Weak</TD>
<TD align="center" id="pwMedium">Medium</TD>
<TD width="33%" align="center" id="pwStrong" title="Has numbers, special characters, lower & upper case characters.">Strong</TD>
</TR>
</TABLE>
<p class="style2">Enter your password to see how strong it is. </p>
<p class="style2">A strong password has numbers, special characters,<br/> lower & upper case characters.</p>

<table width="28%"  border="0" cellspacing="0" cellpadding="5">
  <tr bgcolor="#f03">
    <td width="8%" class="style2"><span class="style1">password&#58;</span></td>
    <td width="92%" class="style2"><input name="txtPassword" type="text" id="txtPassword" onKeyUp="passwordChanged&#40;&#41;" onFocus="clearBox&#40;this&#41;;"  onBlur="fillBox&#40;this&#41;;" value="4+ characters"></td>
  </tr>
</table>
<p class="special">&#40;your password is not stored anywhere by this script&#41;</p>
</div>
</body>
</html>
Αλλά είναι με javascript

Απάντηση

Επιστροφή στο “PHP Προγραμματισμός”

Μέλη σε σύνδεση

Μέλη σε αυτήν τη Δ. Συζήτηση: Δεν υπάρχουν εγγεγραμμένα μέλη και 0 επισκέπτες