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

dhie's Avatar, Join Date: Feb 2009
Light Poster
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
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Could not get what you are asking ?
0
Ryzer's Avatar, Join Date: Feb 2009
Go4Expert Member
Quote:
Originally Posted by dhie View Post
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
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.
0
dhie's Avatar, Join Date: Feb 2009
Light Poster
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!