Note: You can randomly generate a password and then email it to the registered user. You can confirm that the user's email is correct. Automatically Generated passwords are often more secure. At the same time, you can filter invalid users.
Save the following code as a random. asp file:
Quote: <%
Sub strrandomize (strseed)
Dim I, nseed
Nseed = clng (0)
For I = 1 to Len (strseed)
Nseed = nseed XOR (256 * (I-1) mod 4) * ASCB (mid (strseed, I, 1 ))))
Next
Randomize nseed
End sub
Function generatepassword (nlength)
Dim I, bmadeconsonant, C, nrnd
Const strdoubleconsonants = "bdfglmnpst"
Const strconsonants = "bcdfghklmnpqrstv"
Const strvocal = "aeiou"
Generatepassword = ""
Bmadeconsonant = false
For I = 0 to nlength
Nrnd = RND
If generatepassword <> "" And (bmadeconsonant <> true) and (nrnd <0.15) then
C = mid (strdoubleconsonants, INT (LEN (strdoubleconsonants) * RND + 1), 1)
C = C & C
I = I + 1
Bmadeconsonant = true
Else
If (bmadeconsonant <> true) and (nrnd <0.95) then
C = mid (strconsonants, INT (LEN (strconsonants) * RND + 1), 1)
Bmadeconsonant = true
Else
C = mid (strvocal, INT (LEN (strvocal) * RND + 1), 1)
Bmadeconsonant = false
End if
End if
Generatepassword = generatepassword & C
Next
If Len (generatepassword)> nlength then
Generatepassword = left (generatepassword, nlength)
End if
End Function
%>
Then you can call the above Code in your target program to automatically generate the password: (just an example, you can paste them into a test. ASP file, and then run test. ASP)
Quote: <! -- Include file = "random. asp" -->
<%
'Generate a six-digit password
Strrandomize CSTR (now) & CSTR (RND)
Response. Write generatepassword (6)
%>
<%
'Generate an 8-bit password
Strrandomize CSTR (now) & CSTR (RND)
Response. Write generatepassword (8)
%>
<%
'Generate a 10-bit password
Strrandomize CSTR (now) & CSTR (RND)
Response. Write generatepassword (10)
%>
<%
'Generate 1000 passwords
Dim t, T2
For t = 1 to 500
For t2 = 1 to 661
Strrandomize CSTR (now) & CSTR (RND)
Next
Strrandomize CSTR (now) & CSTR (RND)
Response. Write generatepassword (6)
Response. Write "<br>"
Next
%>