Where Can I Download a Password Program for my site membership?

Discussion in 'General Business' started by tesla, Jun 2, 2007.

  1. #1
    I'm looking for a program that can randomly generate passwords for each member who signs up to my site. Does anyone know of a good program?
     
    tesla, Jun 2, 2007 IP
  2. henryzeng

    henryzeng Peon

    Messages:
    199
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    This little function that can generate a completely random password.


    <?php

    /**
    * The letter l (lowercase L) and the number 1
    * have been removed, as they can be mistaken
    * for each other.
    */

    function createRandomPassword() {

    $chars = "abcdefghijkmnopqrstuvwxyz023456789";
    srand((double)microtime()*1000000);
    $i = 0;
    $pass = '' ;

    while ($i <= 7) {
    $num = rand() % 33;
    $tmp = substr($chars, $num, 1);
    $pass = $pass . $tmp;
    $i++;
    }

    return $pass;

    }

    // Usage
    $password = createRandomPassword();
    echo "Your random password is: $password";

    ?>

    http://www.totallyphp.co.uk/code/create_a_random_password.htm
     
    henryzeng, Jun 3, 2007 IP