SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Dec 2000
    Location
    Orange County, Ca
    Posts
    288
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am using php/mysql and I want to generate passwords (combination of letters and numbers) automatically. How could I go about doing this?
    Wordpress Auto Installer
    www.webproco.com

  2. #2
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There are quite a lot of random password generators at zend.com (Code Library/Algorithm)
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy

  3. #3
    SitePoint Wizard silver trophy Karl's Avatar
    Join Date
    Jul 1999
    Location
    Derbyshire, UK
    Posts
    4,411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $password_length = 10;
    srand ((double) microtime() * 1000000);
    $password = md5 (uniqid (rand()));
    $password = substr( $password, 0, $password_length );

    Would give you a password that is 10 chars long. You can change how long you want it to be by changing the $password_length variable.
    Karl Austin :: Profile :: KDA Web Services Ltd.
    Business Web Hosting :: Managed Dedicated Hosting
    Call 0800 542 9764 today and ask how we can help your business grow.

  4. #4
    SitePoint Addict
    Join Date
    Dec 2000
    Location
    Orange County, Ca
    Posts
    288
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks guys, this is just what I needed.
    Wordpress Auto Installer
    www.webproco.com

  5. #5
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cool - thanks for the code man - I don't know if I'll ever need it, but that's something I'd always wondered about - the password is based on the timestamp, right?

  6. #6
    midnight coder
    Join Date
    Dec 2000
    Location
    The flat edge of the world
    Posts
    838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's an article on generating prononceable passwords:

    http://www.phpbuilder.com/columns/jesus19990502.php3

  7. #7
    SitePoint Evangelist
    Join Date
    May 2000
    Location
    Canada
    Posts
    533
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i generally take an array of characters I like (letters, numbers), pick a random number a couple times, pick letters out of the array , ofcourse using srand, etc, etc... seems to work good, another thing to try is to make an MD5 hash off something random, and pick a bunch of characters from it

    ------------------
    SitePoint Community Moderator
    [b]myPHPhost.com[b] - we ARE php, we know PHP, we provide PHP!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •