如何编制一个产生随机密码的函数?
程序员文章站
2022-04-15 09:25:44
<%response.write makepassword(16)function makepasswor...
<%
response.write makepassword(16)
function makepassword(byval maxlen)
dim strnewpass
dim whatsnext, upper, lower, intcounter
randomize
for intcounter = 1 to maxlen
whatsnext = int((1 - 0 + 1) * rnd + 0)
if whatsnext = 0 then
upper = 90
lower = 65
else
upper = 57
lower = 48
end if
strnewpass = strnewpass & chr(int((upper - lower + 1) * rnd + lower))
next
makepassword = strnewpass
' 指定字符范围.
end function
%>
response.write makepassword(16)
function makepassword(byval maxlen)
dim strnewpass
dim whatsnext, upper, lower, intcounter
randomize
for intcounter = 1 to maxlen
whatsnext = int((1 - 0 + 1) * rnd + 0)
if whatsnext = 0 then
upper = 90
lower = 65
else
upper = 57
lower = 48
end if
strnewpass = strnewpass & chr(int((upper - lower + 1) * rnd + lower))
next
makepassword = strnewpass
' 指定字符范围.
end function
%>
[1]
上一篇: 如何对用户进行授权?
下一篇: 如何最大限度地实现安全登录功能?