产生随机密码的函数

 1   
 2response.write makePassword(16)   
 3  
 4function makePassword(byVal maxLen)   
 5  
 6Dim strNewPass   
 7Dim whatsNext, upper, lower, intCounter   
 8Randomize   
 9  
10For intCounter = 1 To maxLen   
11whatsNext = Int((1 - 0 + 1) * Rnd + 0)   
12If whatsNext = 0 Then   
13'character   
14upper = 90   
15lower = 65   
16Else   
17upper = 57   
18lower = 48   
19End If   
20strNewPass = strNewPass & Chr(Int((upper - lower + 1) * Rnd + lower))   
21Next   
22makePassword = strNewPass   
23  
24end function   
Published At
Categories with Web编程
Tagged with
comments powered by Disqus