Method for simply generating passwords (function)

xiaoxiao2021-03-06  124

Method for simply generating passwords

? // Original is Zend.com, reproducted by Hunte / * usage: $ new_password = return_password (); Sample: generated passwords: 2X5bjj2z, ERgid62Y, p2sHtDPv * / function return_password () {// set password length $ pw_length = 8; // SET ASCII RANGE for Random Character Generation $ low_ascii_bound = 50; // "2" $ UPER_ASCII_BOUND = 122; // "Z" // Exclude Special Characters and some confusing alphaplerics // o, o, 0, i, 1, L etc $ notuse = Array (58,59,60,61,62,63,64,73,94,91,92,93,94,95,96,108,111); while ($ 1 $ PW_LENGTH) {mt_srand (((( double) microtime () * 1000000); // random limits within ASCII table $ randnum = mt_rand ($ low_ascii_bound, $ top_ascii_bound);!. if (in_array ($ randnum, $ notuse)) {$ password = $ password chr ($ RandNum); $ I ;}} RETURN $ Password;}?>

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

New Post(0)