Generate A Password

Started on the old forum in January 2008 · view the original in the archive · old links redirect here

3 replies · 712 views · started 18 years ago · 1 min read

2 participants
WhiteWarrior Principal · 1,419 posts #1
/**
 * Generate a password containing letters and numbers.
 *
 * @param int $length
 * @param bool[optional] $mixed_case
 *
 * @return string
 */
function gen_pass($length, $mixed_case=true) {
    $password = '';
    for($i=0;$i<$length;$i++){
        $letter = base_convert(rand(0,35),10,36);
        $password .= ($mixed_case && rand(0,1)) ? strtoupper($letter) : $letter;
    }
    return $password;
}
WhiteWarrior Principal · 1,419 posts #3

lol how about when i lost my password and i want it by email?

For a lava script?..

ive seen the coding for that on another site, ill get and post it because its a diff one because the passwords are md5 so it will need to have a md5 encurpter (or whatever its called) with it

Guest #4

External image (may be gone) Nope, you need send/show random generated password to user, before you md5 it! Coz md5 is all most imposable to decrypt ....

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close