Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 PHP Code: Pronouncable password generator Jump to:  
Category: >> PHP Code >> Pronouncable password generator Bookmark and Share

<< lastnext >>

Snippet Name: Pronouncable password generator

Description: Password generation function for PHP. It allows the developer to customize the password: set its length and strength. Just include this function anywhere in your code and then use it.

Comment: (none)

Language: PHP
Highlight Mode: PHP
Last Modified: February 27th, 2009

<?PHP
 
FUNCTION generatePassword($length=9, $strength=0) {
    $vowels = 'aeuy';
    $consonants = 'bdghjmnpqrstvz';
    IF ($strength & 1) {
        $consonants .= 'BDGHJLMNPQRSTVWXZ';
    }
    IF ($strength & 2) {
        $vowels .= "AEUY";
    }
    IF ($strength & 4) {
        $consonants .= '23456789';
    }
    IF ($strength & 8) {
        $consonants .= '@#$%';
    }
 
    $password = '';
    $alt = TIME() % 2;
    FOR ($i = 0; $i < $length; $i++) {
        IF ($alt == 1) {
            $password .= $consonants[(RAND() % STRLEN($consonants))];
            $alt = 0;
        } ELSE {
            $password .= $vowels[(RAND() % STRLEN($vowels))];
            $alt = 1;
        }
    }
    RETURN $password;
}
 
?>


Free
Oracle Magazine
Subscriptions
and Oracle White Papers


SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 82 users online    © 2009 psoug.org

PSOUG LOGIN
Username: 
Password: 
Forgot your password?