Jump to content

[help] how to randomly generate password for user and send email to user?


Recommended Posts

hi, i'm totally a newbie in php... i hope someone will help me with this problem...

 

actually,i want a script that system will generate password for registered user automatically..and after generated, it will send an email to the user that displayed that password.

and the user will login using that password....

 

can anyone help/guide me? please....

you want an entire log in system with email act?

 

i suggest this

 

http://www.ineedtutorials.com/articles/complete-advanced-login-member-system-php-tutorial

then if you run into issues come here and ask for help this isnt a small project anyone will write out for you

actually  i just want to know how to do a simple password generator.

because for my system, the user just need to enter username and email in registration form...

then admin will approve it and the system will generate the password for that user...

admin will send the password to the user's email...then, user just login with that password...

 

btw, thanks for that link..

  • 2 weeks later...

U can generate a password a number of ways.

 

lets try a simple one eh

function generatepw($length = 6)
{
   $allowed = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-+=";
  $password='';
   for($i=0;$i<$length;$i++)
       $password .= substr($allowed,rand(0,strlen($allowed)-1),1);
   return $password;
}

 

very simple method

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.