用户名 UID Email
  • «
  • 1
  • 2
  • 3
  • »
  • Pages: 1/3     Go
级别: 四星会员
楼主  发表于: 2006-01-24 08:47

 【HACK】仿MSN密码强度 For  PHPWIND ALL

演示:http://qmsw.inlove.be/register.php
进入注册页面,自己随意输入密码就知道了!


1.将以下代码保存为 pswd.js 放在根目录中:
复制代码
  1. var kNoCanonicalCounterpart = 0;
  2. var kCapitalLetter = 0;
  3. var kSmallLetter = 1;
  4. var kDigit = 2;
  5. var kPunctuation = 3;
  6. var kAlpha =  4;
  7. var kCanonicalizeLettersOnly = true;
  8. var kCananicalizeEverything = false;
  9. var gDebugOutput = null;
  10. var kDebugTraceLevelNone = 0;
  11. var kDebugTraceLevelSuperDetail = 120;
  12. var kDebugTraceLevelRealDetail = 100;
  13. var kDebugTraceLevelAll = 80;
  14. var kDebugTraceLevelMost = 60;
  15. var kDebugTraceLevelFew = 40;
  16. var kDebugTraceLevelRare = 20;
  17. var gDebugTraceLevel = kDebugTraceLevelNone;
  18. function DebugPrint()
  19. {
  20. var string = "";
  21. if (gDebugTraceLevel && gDebugOutput &&
  22. DebugPrint.arguments && (DebugPrint.arguments.length > 1) && (DebugPrint.arguments[0] <= gDebugTraceLevel))
  23. {
  24. for(var index = 1; index < DebugPrint.arguments.length; index++)
  25. {
  26. string += DebugPrint.arguments[index] + " ";
  27. }
  28. string += "<br>\n";
  29. gDebugOutput(string);
  30. }
  31. }
  32. function CSimilarityMap()
  33. {
  34. this.m_elements = "";
  35. this.m_canonicalCounterparts = "";
  36. }
  37. function SimilarityMap_Add(element, canonicalCounterpart)
  38. {
  39. this.m_elements += element;
  40. this.m_canonicalCounterparts += canonicalCounterpart;
  41. }
  42. function SimilarityMap_Lookup(element)
  43. {
  44. var canonicalCounterpart = kNoCanonicalCounterpart;
  45. var index = this.m_elements.indexOf(element);
  46. if (index >= 0)
  47. {
  48. canonicalCounterpart = this.m_canonicalCounterparts.charAt(index);
  49. }
  50. else
  51. {
  52. }
  53. return canonicalCounterpart;
  54. }
  55. function SimilarityMap_GetCount()
  56. {
  57. return this.m_elements.length;
  58. }
  59. CSimilarityMap.prototype.Add = SimilarityMap_Add;
  60. CSimilarityMap.prototype.Lookup = SimilarityMap_Lookup;
  61. CSimilarityMap.prototype.GetCount = SimilarityMap_GetCount;
  62. function CDictionaryEntry(length, wordList)
  63. {
  64. this.m_length = length;
  65. this.m_wordList = wordList;
  66. }
  67. function DictionaryEntry_Lookup(strWord)
  68. {
  69. var fFound = false;
  70. if (strWord.length == this.m_length)
  71. {
  72. var nFirst = 0;
  73. var nLast = this.m_wordList.length - 1;
  74. while( nFirst <= nLast )
  75. {
  76. var nCurrent = Math.floor((nFirst + nLast)/2);
  77. if( strWord == this.m_wordList[nCurrent])
  78. {
  79. fFound = true;
  80. break;
  81. }
  82. else if ( strWord > this.m_wordList[nCurrent])
  83. {
  84. nLast = nCurrent - 1;
  85. }
  86. else
  87. {
  88. nFirst = nCurrent + 1;
  89. }
  90. }
  91. }
  92. return fFound;
  93. }
  94. CDictionaryEntry.prototype.Lookup = DictionaryEntry_Lookup;
  95. function CDictionary()
  96. {
  97. this.m_entries = new Array()
  98. }
  99. function Dictionary_Lookup(strWord)
  100. {
  101. for (var index = 0; index < this.m_entries.length; index++)
  102. {
  103. if (this.m_entries[index].Lookup(strWord))
  104. {
  105. return true;
  106. }
  107. }
  108. }
  109. function Dictionary_Add(length, wordList)
  110. {
  111. var iL=this.m_entries.length;
  112. var cD=new CDictionaryEntry(length, wordList)
  113. this.m_entries[iL]=cD;
  114. }
  115. CDictionary.prototype.Lookup = Dictionary_Lookup;
  116. CDictionary.prototype.Add = Dictionary_Add;
  117. var gSimilarityMap = new CSimilarityMap();
  118. var gDictionary = new CDictionary();
  119. function CharacterSetChecks(type, fResult)
  120. {
  121. this.type = type;
  122. this.fResult = fResult;
  123. }
  124. function isctype(character, type, nDebugLevel)
  125. {
  126. var fResult = false;
  127. switch(type)
  128. {
  129. case kCapitalLetter:
  130. if((character >= 'A') && (character <= 'Z'))
  131. {
  132. fResult = true;
  133. }
  134. break;
  135. case kSmallLetter:
  136. if ((character >= 'a') && (character <= 'z'))
  137. {
  138. fResult = true;
  139. }
  140. break;
  141. case kDigit:
  142. if ((character >= '0') && (character <= '9'))
  143. {
  144. fResult = true;
  145. }
  146. break;
  147. case kPunctuation:
  148. if ("!@#$%^&*()_+-='\";:[{]}\|.>,</?`~".indexOf(character) >= 0)
  149. {
  150. fResult = true;
  151. }
  152. break;
  153. case kAlpha:
  154. if (isctype(character, kCapitalLetter) || isctype(character, kSmallLetter))
  155. {
  156. fResult = true;
  157. }
  158. break;
  159. default:
  160. break;
  161. }
  162. return fResult;
  163. }
  164. function CanonicalizeWord(strWord, similarityMap, fLettersOnly)
  165. {
  166. var canonicalCounterpart = kNoCanonicalCounterpart;
  167. var strCanonicalizedWord = "";
  168. var nStringLength = 0;
  169. if ((strWord != null) && (strWord.length > 0))
  170. {
  171. strCanonicalizedWord = strWord;
  172. strCanonicalizedWord = strCanonicalizedWord.toLowerCase();
  173. if (similarityMap.GetCount() > 0)
  174. {
  175. nStringLength = strCanonicalizedWord.length;
  176. for(var index = 0; index < nStringLength; index++)
  177. {
  178. if (fLettersOnly && !isctype(strCanonicalizedWord.charAt(index), kSmallLetter, kDebugTraceLevelSuperDetail))
  179. {
  180. continue;
  181. }
  182. canonicalCounterpart = similarityMap.Lookup(strCanonicalizedWord.charAt(index));
  183. if (canonicalCounterpart != kNoCanonicalCounterpart)
  184. {
  185. strCanonicalizedWord = strCanonicalizedWord.substring(0, index) + canonicalCounterpart +
  186. strCanonicalizedWord.substring(index + 1, nStringLength);
  187. }
  188. }
  189. }
  190. }
  191. return strCanonicalizedWord;
  192. }
  193. function IsLongEnough(strWord, nAtLeastThisLong)
  194. {
  195. if ((strWord == null) || isNaN(nAtLeastThisLong))
  196. {
  197. return false;
  198. }
  199. else if (strWord.length < nAtLeastThisLong)
  200. {
  201. return false;
  202. }
  203. return true;
  204. }
  205. function SpansEnoughCharacterSets(strWord, nAtLeastThisMany)
  206. {
  207. var nCharSets = 0;
  208. var characterSetChecks = new Array(
  209. new CharacterSetChecks(kCapitalLetter, false),
  210. new CharacterSetChecks(kSmallLetter, false),
  211. new CharacterSetChecks(kDigit, false),
  212. new CharacterSetChecks(kPunctuation, false)
  213. );
  214. if ((strWord == null) || isNaN(nAtLeastThisMany))
  215. {
  216. return false;
  217. }
  218. for(var index = 0; index < strWord.length; index++)
  219. {
  220. for(var nCharSet = 0; nCharSet < characterSetChecks.length;nCharSet++)
  221. {
  222. if (!characterSetChecks[nCharSet].fResult && isctype(strWord.charAt(index), characterSetChecks[nCharSet].type, kDebugTraceLevelAll))
  223. {
  224. characterSetChecks[nCharSet].fResult = true;
  225. break;
  226. }
  227. }
  228. }
  229. for(var nCharSet = 0; nCharSet < characterSetChecks.length;nCharSet++)
  230. {
  231. if (characterSetChecks[nCharSet].fResult)
  232. {
  233. nCharSets++;
  234. }
  235. }
  236. if (nCharSets < nAtLeastThisMany)
  237. {
  238. return false;
  239. }
  240. return true;
  241. }
  242. function FoundInDictionary(strWord, similarityMap, dictionary)
  243. {
  244. var strCanonicalizedWord = "";
  245. if((strWord == null) || (similarityMap == null) || (dictionary == null))
  246. {
  247. return true;
  248. }
  249. strCanonicalizedWord = CanonicalizeWord(strWord, similarityMap, kCanonicalizeLettersOnly);
  250. if (dictionary.Lookup(strCanonicalizedWord))
  251. {
  252. return true;
  253. }
  254. return false;
  255. }
  256. function IsCloseVariationOfAWordInDictionary(strWord, threshold, similarityMap, dictionary)
  257. {
  258. var strCanonicalizedWord = "";
  259. var nMinimumMeaningfulMatchLength = 0;
  260. if((strWord == null) || isNaN(threshold) || (similarityMap == null) || (dictionary == null))
  261. {
  262. return true;
  263. }
  264. strCanonicalizedWord = CanonicalizeWord(strWord, similarityMap, kCananicalizeEverything);
  265. nMinimumMeaningfulMatchLength = Math.floor((threshold) * strCanonicalizedWord.length);
  266. for (var nSubStringLength = strCanonicalizedWord.length; nSubStringLength >= nMinimumMeaningfulMatchLength; nSubStringLength--)
  267. {
  268. for(var nSubStringStart = 0; (nSubStringStart + nMinimumMeaningfulMatchLength) < strCanonicalizedWord.length; nSubStringStart++)
  269. {
  270. var strSubWord = strCanonicalizedWord.substr(nSubStringStart, nSubStringLength);
  271. if (dictionary.Lookup(strSubWord))
  272. {
  273. return true;
  274. }
  275. }
  276. }
  277. return false;
  278. }
  279. function ClientSideStrongPassword()
  280. {
  281. return (IsLongEnough(ClientSideStrongPassword.arguments[0], "7") &&
  282. SpansEnoughCharacterSets(ClientSideStrongPassword.arguments[0], "3") &&
  283. (!(IsCloseVariationOfAWordInDictionary(ClientSideStrongPassword.arguments[0], "0.6",
  284. ClientSideStrongPassword.arguments[1], ClientSideStrongPassword.arguments[2]))));
  285. }
  286. function ClientSideMediumPassword()
  287. {
  288. return (IsLongEnough(ClientSideMediumPassword.arguments[0], "7") &&
  289. SpansEnoughCharacterSets(ClientSideMediumPassword.arguments[0], "2") &&
  290. (!(FoundInDictionary(ClientSideMediumPassword.arguments[0], ClientSideMediumPassword.arguments[1],
  291. ClientSideMediumPassword.arguments[2]))));
  292. }
  293. function ClientSideWeakPassword()
  294. {
  295. return (IsLongEnough(ClientSideWeakPassword.arguments[0], "6") ||
  296. (!(IsLongEnough(ClientSideWeakPassword.arguments[0], "0"))));
  297. }
  298. function GEId(sID){return document.getElementById(sID);}
  299. function EvalPwdStrength(oF,sP){PadPasswd(oF,sP.length*2);if(ClientSideStrongPassword(sP,gSimilarityMap,gDictionary)){DispPwdStrength(3,'css0165');}else if(ClientSideMediumPassword(sP,gSimilarityMap,gDictionary)){DispPwdStrength(2,'css0164');}else if(ClientSideWeakPassword(sP,gSimilarityMap,gDictionary)){DispPwdStrength(1,'css0163');}else{DispPwdStrength(0,'css0162');}}function SetPwdStrengthEx(oF,sP){EvalPwdStrength(oF,sP);if(ClientSideStrongPassword(sP,gSimilarityMap,gDictionary)){document.cookie="pwdstrength=3";}else if(ClientSideMediumPassword(sP,gSimilarityMap,gDictionary)){document.cookie="pwdstrength=2";}else if(ClientSideWeakPassword(sP,gSimilarityMap,gDictionary)){document.cookie="pwdstrength=1";}else{document.cookie="pwdstrength=0";}}function SetPwdStrength(sP,oF){if(ClientSideStrongPassword(sP,gSimilarityMap,gDictionary)){oF.value = 3;}else if(ClientSideMediumPassword(sP,gSimilarityMap,gDictionary)){oF.value = 2;}else if(ClientSideWeakPassword(sP,gSimilarityMap,gDictionary)){oF.value = 1;}else{oF.value = 0;}}function XPWCont(){if (typeof(parent.opener.RegistrationFinishedCallback)!="undefined"){parent.opener.RegistrationFinishedCallback();}parent.close();}function OnSigninSubmit(oF){if(g_fAS){return false;}if(typeof oF!="object"){return false;}var bL=true,bP=true,bI=true,bH=true;bL=Val(oF.login);var sEM=oF.login.value;bL=ValEM(sEM);if(typeof oF.passwd=="object"){bP=Val(oF.passwd);}if(typeof oF.pin=="object"){bI=Val(oF.pin);}if(typeof oF.HIPSolution=="object"){bH=Val(oF.HIPSolution);}if(!bL||!bP||!bI||!bH){var fSF=true;var aE=["i0518","i0519","i0512","i0527","i0545","i0562","i0517"];HDivs(aE);if(!bL){fSF=SwErr("i0519",oF.login,fSF)};if(!bI){fSF=SwErr("i0527",oF.pin,fSF)};if(!bH){fSF=SwErr("i0517",oF.HIPSolution,fSF)};if(!bP){fSF=SwErr("i0512",oF.passwd,fSF)};return false;}if(typeof oF.passwd=="object"){PadPasswd(oF,oF.passwd.value.length);}if(typeof g_DO!="undefined"){var dom=sEM.substr(sEM.indexOf('@')+1);var sU=g_DO[dom.toLowerCase()];if(sU){oF.action=sU;}}if(typeof g_QS!="undefined"){if(g_QS){var sS="&";if(oF.action.indexOf('?')==-1){sS="?";}if(oF.action.indexOf(g_QS)==-1){oF.action+=sS+g_QS;}}}g_fAS=true;oF.login.value=oF.login.value.toLowerCase();oF.submit();return false;}function OnPadSubmit(oF){if(typeof oF.CurrPW=="object"){PadPasswd(oF,oF.CurrPW.value.length);}oF.submit();return false;}function OnPadSubmitWithAction(oF,szU){if(typeof oF.CurrPW=="object"){PadPasswd(oF,oF.CurrPW.value.length);}return OnSubmitWithAction(oF,szU);}function PadPasswd(oF,lPwd){if(typeof oF.PwdPad=="object"){var sPad="IfYouAreReadingThisYouHaveTooMuchFreeTime";var lPad=sPad.length-lPwd;oF.PwdPad.value=sPad.substr(0,(lPad<0)?0:lPad);}}function HDivs(aE){for(var i=0;i<aE.length;++i){var o=GEId(aE[i]);if(o){o.style.display="none";}}}function SwErr(sID,oFN,fSF){GEId(sID).style.display="block";if(fSF){oFN.focus();oFN.select();}return false;
  300. }


2.查找template\wind\register.htm
复制代码
  1. <input type=password size=20 maxlength=75 name=regpwd> 英文字母或数字等不少于6位</td></tr>


修改为:
复制代码
  1. <input type=password size=20 maxlength=75 name=regpwd onkeyup="javascript:SetPwdStrengthEx(document.forms[0],this.value);"> 英文字母或数字等不少于6位
  2.     <script type="text/javascript" src="pswd.js"></script>
  3.                   <script type="text/javascript">
  4.             function DispPwdStrength(iN,sHL)
  5.            { if(iN>3){ iN=3;}for(var i=0;i<4;i++){ var sHCR="css0162";if(i<=iN){ sHCR=sHL;}if(i>0){ GEId("idSM"+i).className=sHCR;}GEId("idSMT"+i).style.display=((i==iN)?"inline":"none");}}
  6.            </script>
  7.     <table style="width: 140px; height: 1px;" cellpadding="0" cellspacing="0"><tbody><td id="idSM1" style="background-color:#CCCCCC;border-right:solid 1px #BEBEBE;border-bottom:solid 1px #BEBEBE;" align="center" width="33%"><span style="font-size: 1px;"> </span>
  8.     <span id="idSMT1" style="display: none; color:#FF0000">弱</span></td>
  9.     <td id="idSM2" style="background-color:#CCCCCC;border-right:solid 1px #BEBEBE;border-bottom:solid 1px #BEBEBE;" align="center" width="34%"><span style="font-size: 1px;"> </span>
  10.     <span id="idSMT0" style="display: inline; font-weight: normal; color:#6633FF">强度</span>
  11.     <span id="idSMT2" style="display: none; color:#FF9900">中</span></td><td id="idSM3" style="background-color:#CCCCCC;border-right:solid 1px #BEBEBE;border-bottom:solid 1px #BEBEBE;"  align="center" width="33%"><span style="font-size: 1px;"> </span>
  12.     <span id="idSMT3" style="display: none; color:#339900">强</span></tbody></table></td>
  13.    </td></tr>
[ 此贴被eyecoco在2008-07-29 06:41重新编辑 ]
都話唔好囉. 你明唔明嗜
级别: 六星会员
最佳建议奖
1楼  发表于: 2006-01-24 09:26
路過 ! 支持
http://www.markethongkong.com.hk/fairtrade/
☜♡☞ well done is better than well said ☜♡☞
☜♡☞ http://www.fairtradeshop.hk/ ☜♡☞
☜♡☞ http://bbs.askme.hk ☜♡☞
QQ : 649618506
BBs.BTYYY.Com
级别: 五星会员
2楼  发表于: 2006-01-24 10:06
多谢哦
诸位~想干什么就干什么吧!什么??你不知道要干什么?!请把什么去掉后自行发挥吧~
City Hunter
级别: PW插件支持团队
3楼  发表于: 2006-01-24 10:12
強~~!
支持中
欢迎加入PHPblast Support Team 团体
pw~
级别: 一星会员
4楼  发表于: 2006-01-24 10:58
未解決,未解決,未解決
你有壓力,我有壓力........
老子只做英文站
级别: 商业版用户
5楼  发表于: 2006-01-24 12:35
胆子真大,能帮我申请个日本的空间吗
级别: 新手上路
6楼  发表于: 2006-01-24 12:59
这个东西倒是蛮不错的。 可是怎么老是让点击日本的网站那?
转行做程序,从JAVA开始!
级别: 四星会员
7楼  发表于: 2006-01-24 14:23
貌似我以前发过这个东西~~~~
spe
级别: 一星会员
8楼  发表于: 2006-01-24 14:42
级别: 四星会员
9楼  发表于: 2006-01-24 23:34
Quote:
引用第7楼dafei12882006-01-24 14:23发表的“”:
貌似我以前发过这个东西~~~~

对不起,没看过你发的,这个我是自己修改的,你可以查看演示,不可能这么巧修改得这么相像吧!
级别: 四星会员
10楼  发表于: 2006-01-24 23:52
搞得太复杂了 
转行做程序,从JAVA开始!
级别: 四星会员
11楼  发表于: 2006-01-25 02:21
Quote:
引用第9楼eyecoco2006-01-24 23:34发表的“”:

对不起,没看过你发的,这个我是自己修改的,你可以查看演示,不可能这么巧修改得这么相像吧!


米关系啦~~都是为大家服务~~~呵呵~只不过这样可能造成重复劳动~

我那个也不全是自己弄的~哈~~ 共同学习进步~才是目的~
pw小窝灌水队:54zyn.com
级别: 三星会员
12楼  发表于: 2006-01-25 09:47
顶//
人道海底 深, 不及相思半, 海底尚有涯, 相思遥无岸
级别: 四星会员
13楼  发表于: 2006-01-25 23:26