Go4Expert

Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   Help !! How to include temporary password int o your signup or log in page in php (http://www.go4expert.com/forums/help-include-temporary-password-int-o-t16207/)

dhie 16Feb2009 11:46

Help !! How to include temporary password int o your signup or log in page in php
 
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

shabbir 16Feb2009 12:32

Re: Help !! How to include temporary password int o your signup or log in page in php
 
Could not get what you are asking ?

Ryzer 16Feb2009 22:26

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

Originally Posted by dhie (Post 42958)
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.

dhie 17Feb2009 06:41

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:


All times are GMT +5.5. The time now is 05:28.