How could i add a "Forgott My Password" buton, i know how i would send emails via php but how would i get the users password,username,email. As i would like to have it when you press forgott by password it asks for the username and sends it there password to the users email i would have a phpscript something like this: PHP: <?php $username = $_POST['user']; $password = "HOW DO I GET USERS PASS"; $email = "HOW DO I GET USERS EMAIL"; $message = "Hello, \n You have requested your password: 2\n Your Password is: ".$password; mail($email, 'Forgotten Password', $message); ?>
All clients and reseller passwords are stored md5 encrypted in the database table sys_user, so you can not get the original password back. I recommend to create a new password instead and send this newly created password to the client.
Thanks, how would i save the users changed password? And find form the username there email address Thanks again Heres my script that should work, just needs a few more varibles PHP: <?php // Make Password $salt = "abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ123456789"; srand((double)microtime()*1000000); // start the random generator $password=""; // set the inital variable for ($i=0;$i<6;$i++) $password = $password . substr ($salt, rand() % strlen($salt), 1); // Varibles $newpass = md5($password); $username = $_POST['user']; $email = "???"; $message = "Hello, \n You have we have automatically changed your password as you appear to have forgooten it: 2\n Your New Password is: ".$newpass; mail($email, 'Forgotten Password', $message); ?>
I guess you mix up client paswords with email passwords. Client passwords are not encrypted with crypt and clients do not nescesarily have a email address, clients are referenced by their username, the clients email address is optional.