Revision: 10177
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 11, 2008 05:33 by svenito
Initial Code
function generatePassword ($length = 8) { $password = ""; $possible = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-$!?]["; $i = 0; // add random characters to $password until $length is reached while ($i < $length) { // pick a random character from the possible ones $char = substr($possible, mt_rand(0, strlen($possible)-1), 1); // we don't want this character if it's already in the password if (!strstr($password, $char)) { $password .= $char; $i++; } } return $password; }
Initial URL
Initial Description
Initial Title
random pass generator
Initial Tags
Initial Language
PHP