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.
//generate random password to be emailed to user
function createRandomPassword() {
    $chars = "abcdefghijkmnopqrstuvwxyz023456789";
    $i = 0;
    $pass = '' ;
    while ($i <= 7) {
        $num = rand() % 33;
        $tmp = substr($chars, $num, 1);
        $pass = $pass . $tmp;
    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.