forgot password reset

Discussion in 'PHP' started by beermaker74, Feb 13, 2007.

  1. #1
    for my login form i have a link to click on if you forgot password. How do i create a random string to insert into the pass field to let them log back in and change password?
     
    beermaker74, Feb 13, 2007 IP
  2. designcode

    designcode Well-Known Member

    Messages:
    738
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    118
    #2
    You can use many tricks to create random string,
    like

    $randomPass = date("YmdHis") . rand(1, 9999999);

    hope this helps.
     
    designcode, Feb 13, 2007 IP
  3. grandpa

    grandpa Active Member

    Messages:
    185
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    75
    #3
    i use this:

    $len = 10; //random pass length
    $password = '';
    for ($i=1; $i<=$len; $i++){
    $set = array(rand (65,90),rand(97,122));
    $password .= chr($set[rand(0,1)]);
    }

    echo $password; //result will be like "sgvUkvSUTg"
     
    grandpa, Feb 13, 2007 IP
  4. Icheb

    Icheb Peon

    Messages:
    1,092
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Or just use

    sha1(md5(rand(1, 99999999)));
    PHP:
    No one will ever figure out how you created that. ;)
     
    Icheb, Feb 13, 2007 IP
  5. beermaker74

    beermaker74 Peon

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    works great
    thanks for the help
     
    beermaker74, Feb 14, 2007 IP