1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Help !! How to include temporary password int o your signup or log in page in php

Discussion in 'PHP' started by dhie, Feb 16, 2009.

  1. dhie

    dhie New Member

    Joined:
    Feb 16, 2009
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    Help me pls? amm a newbie but i want to know how or the complete script of lig in system with temporary Password given by the admin thank you and Godbles!1
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,287
    Likes Received:
    364
    Trophy Points:
    83
    Could not get what you are asking ?
     
  3. Ryzer

    Ryzer New Member

    Joined:
    Feb 15, 2009
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Pipeline Maintenance
    Location:
    Saskatchewan, Canada
    You can create a randomly generated string to be set as the password when the user register's. Probably emailing the password to the new user forcing the user to choose a new password when they use the randomly generated one to login the first time.

    Here is the random password code excluding characters "l" and "1" to prevent confusion between the two.
    Code:
    //generate random password to be emailed to user
    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;
    }
    
    As for emailing, just use the mail() function. Details can be easily found on the net for this function. Forcing the user to choose a new password could be tricky business but I would probably go about this by creating a new value in the database table for numberOfLogins. If it equals 1, you know its their first time logging in so have them change their password. This also might be a good value to use for cleaning up your database say two years down the road, if a user has logged in twice in the past two years chances are they won't even remember they have an account.
     
  4. dhie

    dhie New Member

    Joined:
    Feb 16, 2009
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    Re: Help !! Can anyone pls send me a code of login and signup with temporary password

    help me plS? can any one send me the login and signup with admin panel and temporary password.... thank you and Godbless!!! hope for further reply! :confused::happy:
     

Share This Page