<% @LANGUAGE="VBSCRIPT" CODEPAGE="936" %>
<%
' 返回0:输入字符串为空
' 返回1~4:复杂度为1~4
' 返回大于4:包含有汉字或者键盘上无法输入的字符,减去100再加一就是实际的复杂度
Public Function GetComplicacyOfPassword(strPwd)
If Len(strPwd)=0 Then
GetComplicacyOfPassword=0
Exit Function
End If
Dim cUpperChar,cLowerChar,cNumeric,cSpecialChar,cOther
Dim iCnt,ascTmp
cUpperChar=0
cLowerChar=0
cNumeric=0
cSpecialChar=0
cOther=0
For iCnt=1 To Len(strPwd)
ascTmp=Asc(Mid(strPwd,iCnt,1))
If ascTmp>0 And ascTmp<127 Then
If ascTmp>=Asc("A") And ascTmp<=Asc("Z") Then 'A ~ Z
cUpperChar=1
ElseIf ascTmp>=Asc("a") And ascTmp<=Asc("z") Then 'a ~ z
cLowerChar=1
ElseIf ascTmp>=Asc("0") And ascTmp<=Asc("9") Then '0 ~ 9
cNumeric=1
ElseIf ascTmp>=33 And ascTmp<=47 Then '! ~ /
cSpecialChar=1
ElseIf ascTmp>=58 And ascTmp<=64 Then ': ~ @
cSpecialChar=1
ElseIf ascTmp>=91 And ascTmp<=96 Then '[ ~ `
cSpecialChar=1
ElseIf ascTmp>=123 And ascTmp<=126 Then '{ ~ ~
cSpecialChar=1
End If
Else
cOther=1 '汉字或者键盘上无法输入的字符
End If
Next
GetComplicacyOfPassword=cUpperChar+cLowerChar+cNumeric+cSpecialChar+cOther*100
End Function
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="pragma" content="no-cache" />
<style type="text/css">
<!--
-->
</style>
<script language="JavaScript">
<!--
-->
</script>
<title></title>
</head>
<body>
GetComplicacyOfPassword("")=<%=GetComplicacyOfPassword("")%><br />
GetComplicacyOfPassword("asdadajkhdask")=<%=GetComplicacyOfPassword("asdadajkhdask")%><br />
GetComplicacyOfPassword("asdadAskhdDsk")=<%=GetComplicacyOfPassword("asdadAskhdDsk")%><br />
GetComplicacyOfPassword("asdADAjk1235k")=<%=GetComplicacyOfPassword("asdADAjk1235k")%><br />
GetComplicacyOfPassword("aSDADa#12ka@k")=<%=GetComplicacyOfPassword("aSDADa#12ka@k")%><br />
GetComplicacyOfPassword("asdadaj你好sk")=<%=GetComplicacyOfPassword("asdadaj你好sk")%><br />
GetComplicacyOfPassword("asdadaj你好sk")实际为<%=GetComplicacyOfPassword("asdadaj你好sk")-99%><br />
</body>
</html>