สร้างรหัสผ่านผู้ใช้แบบสุ่ม (ดี) คำแนะนำ: โดยการสร้างรหัสผ่านแบบสุ่มแล้วส่งอีเมลรหัสผ่านไปยังผู้ใช้ที่ลงทะเบียนคุณสามารถยืนยันได้ว่าอีเมลของผู้ใช้จะถูกกรอกข้อมูลอย่างถูกต้องหรือไม่
หมายเหตุ: โดยการสร้างรหัสผ่านแบบสุ่มจากนั้นส่งอีเมลรหัสผ่านไปยังผู้ใช้ที่ลงทะเบียนคุณสามารถยืนยันได้ว่าอีเมลของผู้ใช้เต็มไปอย่างถูกต้องหรือไม่ รหัสผ่านที่สร้างขึ้นโดยอัตโนมัติมีแนวโน้มที่จะปลอดภัยมากขึ้นและในเวลาเดียวกันคุณสามารถกรองผู้ใช้ที่ไม่ถูกต้อง
บันทึกรหัสต่อไปนี้เป็นไฟล์สุ่ม ASP:
การคัดลอกรหัสมีดังนี้:
-
substrrandomize (strseed)
Dimi, nseed
nseed = clng (0)
fori = 1tolen (strseed)
nseed = nseedxor ((256*((i-1) mod4)*ascb (mid (strseed, i, 1))))))))))))))))))))))))
ต่อไป
แบบสุ่ม
enddub
FunctionGeneratePassword (nlength)
DiMi, bmadeconsonant, c, nrnd
constStstrDoubleConSonants = "bdfglmnpst"
constStSTRCONSONANTS = "BCDFGHKLMNPQRSTV"
constStSTRVOCAL = "AEIOU"
generatePassword = ""
bmadeconsonant = false
fori = 0Tonlength
nrnd = rnd
ifgeneratePassword <> "" และ (bmadeconsonant <> true) และ (nrnd <0.15) จากนั้น
c = mid (strdoubleConsonants, int (len (strdoubleConsonants)*rnd+1), 1)
C = C&C
i = i+1
bmadeconsonant = true
อื่น
ถ้า (bmadeconsonant <> true) และ (nrnd <0.95) แล้ว
c = mid (strconsonants, int (len (strconsonants)*rnd+1), 1)
bmadeconsonant = true
อื่น
c = mid (strvocal, int (len (strvocal)*rnd+1), 1)
bmadeconsonant = false
endif
endif
generatePassword = generatePassword & c
ต่อไป
iflen (generatePassword)> nlengthThen
generatePassword = ซ้าย (generatePassword, nlength)