programming-examples/asp/Components/Auto Generate Password.asp
2019-11-18 14:25:58 +01:00

34 lines
589 B
Plaintext

<%@ Language=VBScript %>
<HTML>
<HEAD>
</HEAD>
<BODY>
<%
Function gen_key(digits)
dim char_array(50)
iTestChar = Asc("0")
For i = 0 To 9
char_array(i) = Chr(iTestChar)
iTestChar = iTestChar + 1
Next
iTestChar = Asc("A")
For i = 10 To 10 + 25
char_array(i) = Chr(iTestChar)
iTestChar = iTestChar + 1
Next
randomize
do while len(output) < digits
num = char_array(Int((35 - 12 + 1) * Rnd + 5))
output = output + num
loop
gen_key = output
End Function
response.write gen_key(13)
%>
</BODY>
</HTML>