Requesting Help with login script
Moderator: General Moderators
-
kgscott284
- Forum Newbie
- Posts: 3
- Joined: Fri Dec 04, 2009 4:43 pm
Requesting Help with login script
Essentially I have implemented a login script that is very basic and sends the user a password via email using md5 hash...obviously most people are not going to want to remember these passwords so i was wondering if someone could help me with a change password function...or point me somewhere that can help...I have searched google for tutorials and even looked through hotscripts but have been unsuccessful...Thank you for your time.
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: Requesting Help with login script
Normally you let the user pick their password 'mypassword12' or generate one with letters/numbers, etc... and store as a hash (md5() hash, whatever) in the DB. Then when the user logs in they supply their password 'mypassword12' and you md5() hash it and compare with the DB value. They don't have access to the hash of their password.
-Shawn
-Shawn
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
-
kgscott284
- Forum Newbie
- Posts: 3
- Joined: Fri Dec 04, 2009 4:43 pm
Re: Requesting Help with login script
sorry i didn't explain well, what i meant was the password is automatically generated...e.g.
I just need to figure out how to make a change password script so users can set their own passwords after receiving the confirmation email
Code: Select all
substr(md5($_SERVER['REMOTE_ADDR'].microtime().rand(1,100000)),0,6);
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: Requesting Help with login script
Just have a form where they supply their generated password and new password. Post it, and:
Not sure what you need.
Code: Select all
"UPDATE users_table SET password = '" . mysql_real_escape_string($_POST['new_password']) . "' WHERE username = '$username' AND password = '$old_password'"
Last edited by AbraCadaver on Thu Dec 10, 2009 1:40 pm, edited 1 time in total.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
-
kgscott284
- Forum Newbie
- Posts: 3
- Joined: Fri Dec 04, 2009 4:43 pm
Re: Requesting Help with login script
thats exactly what i need...
thanks alot i really appreciate it...
thanks alot i really appreciate it...