|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
asp对于服务器的要求较高,一般的服务器如果访问量一大就垮了,不得不重启。 列位好明天我要告知人人的是若何用ASP发生随机数。人人都晓得大多半网站注册后
供应用户名和一个随秘密码,但这个暗码是若何发生的,如今我就向人人来引见一下
请看上面的例子,用户可自行增添或削减随机的字符或数目。
<%
Function gen_key(digits)
'Create and define array
dim char_array(50)
char_array(0) = "0"
char_array(1) = "1"
char_array(2) = "2"
char_array(3) = "3"
char_array(4) = "4"
char_array(5) = "5"
char_array(6) = "6"
char_array(7) = "7"
char_array(8) = "8"
char_array(9) = "9"
char_array(10) = "A"
char_array(11) = "B"
char_array(12) = "C"
char_array(13) = "D"
char_array(14) = "E"
char_array(15) = "F"
char_array(16) = "G"
char_array(17) = "H"
char_array(18) = "I"
char_array(19) = "J"
char_array(20) = "K"
char_array(21) = "L"
char_array(22) = "M"
char_array(23) = "N"
char_array(24) = "O"
char_array(25) = "P"
char_array(26) = "Q"
char_array(27) = "R"
char_array(28) = "S"
char_array(29) = "T"
char_array(30) = "U"
char_array(31) = "V"
char_array(32) = "W"
char_array(33) = "X"
char_array(34) = "Y"
char_array(35) = "Z"
'Initiate randomize method for default seeding
randomize
'Loop through and create the output based on the the variable passed to
'the function for the length of the key.
do while len(output) < digits
num = char_array(Int((35 - 0 + 1) * Rnd + 0))
output = output + num
loop
'Set return
gen_key = output
End Function
'Write the results to the browser, currently setting a 13 digit key
response.write "<pre>" & gen_key(13) & "</pre>" & vbcrlf
%>
强大的可扩展性。ASP具有强大的扩展性,可以实现与多种网络、硬件设备的连接:通过专用的通讯线路远程接入企业; 通过远程拨号服务器为远程拨号客户提供服务;通过WAP为移动电话互联网客户服务。 |
|