asp 下产生任意位数随机密码的代码
程序员文章站
2023-08-24 12:53:10
<% '****************************** '函数:makepassword(byval maxlen) '参数:maxlen,要...
<%
'******************************
'函数:makepassword(byval maxlen)
'参数:maxlen,要生成的密码位数长度
'作者:阿里西西
'日期:2007/7/12
'描述:产生任意位数随机密码
'示例:<%=makepassword(8)%>
'******************************
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
'character
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
%>
'******************************
'函数:makepassword(byval maxlen)
'参数:maxlen,要生成的密码位数长度
'作者:阿里西西
'日期:2007/7/12
'描述:产生任意位数随机密码
'示例:<%=makepassword(8)%>
'******************************
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
'character
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
%>
上一篇: asp之自动闭合HTML/ubb标签函数附简单注释
下一篇: asp form 表单验证函数