Randomly generate user password

zhaozj2021-02-16  62

Randomly generate user password (good)

March 25,2004 Description: By randomly generate password, then password email to the registered user, you can confirm that the user's email is correct. Automatically generated passwords are often more secure, while you can filter those invalid users.

Save the following code as Random.asp file: <% 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 nSeedEnd subFunction 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 * RND 1), 1) Bmadeconsonant = true else c = MID (Strvocal, int (Len (strVocal) * RND 1), 1) Bmadeconsonant = False end if endiff = generatepassword & c next if len (generatepassword)>

转载请注明原文地址:https://www.9cbs.com/read-17284.html

New Post(0)