Jump to content

please help. !!


georgebates

Recommended Posts

Hi there,

 

I got this login/registration script from a website and it encrypts the passwords before entering them into the database. I am making a lost password section and need to decrypt the password now but im not sure how too.

 

This is the code that they use to encrypt the password:

 

// here we encrypt the password and add slashes if needed
$_POST['pass'] = md5($_POST['pass']);
if (!get_magic_quotes_gpc()) {
$_POST['pass'] = addslashes($_POST['pass']);
$_POST['username'] = addslashes($_POST['username']);
}

Link to comment
https://forums.phpfreaks.com/topic/183249-please-help/
Share on other sites

for reset a password you create a table that stores the req, say

 

username, request_hash

 

request hash will be something you generate, like md5(time().$username) or any combination store it in the database, make another page to handle password reset, send a link to the user in his/her email something like reset.php?hash=request_hash

 

once the user comes to your reset page check for which user does the hash exists for, give him/her a prompt to enter existing password and new password, check the existing password with the database (same as you did with login) if it checks out correct change the password.

 

hope the explaining was useful

Link to comment
https://forums.phpfreaks.com/topic/183249-please-help/#findComment-967153
Share on other sites

for reset a password you create a table that stores the req, say

 

username, request_hash

 

request hash will be something you generate, like md5(time().$username) or any combination store it in the database, make another page to handle password reset, send a link to the user in his/her email something like reset.php?hash=request_hash

 

once the user comes to your reset page check for which user does the hash exists for, give him/her a prompt to enter existing password and new password, check the existing password with the database (same as you did with login) if it checks out correct change the password.

 

hope the explaining was useful

 

Hey rajiv, long time no see,

 

anyway for a password reset you wouldnt check it against the current password as they have forgotten it. simply add a field email or something similar, basically just another identification string that is included in the url so they cant guess them

 

Link to comment
https://forums.phpfreaks.com/topic/183249-please-help/#findComment-967173
Share on other sites

what is better is to ask them for their email address or username and then send an email to the relevant email with a link to a page that will allow them to enter a new password, as thy shoudl be the only person with their email details they should be the only person with the relevant link that you send which may be checked by submiting a php page and checking the string requested from a databse which expires after so long etc.

Link to comment
https://forums.phpfreaks.com/topic/183249-please-help/#findComment-967190
Share on other sites

for reset a password you create a table that stores the req, say

 

username, request_hash

 

request hash will be something you generate, like md5(time().$username) or any combination store it in the database, make another page to handle password reset, send a link to the user in his/her email something like reset.php?hash=request_hash

 

once the user comes to your reset page check for which user does the hash exists for, give him/her a prompt to enter existing password and new password, check the existing password with the database (same as you did with login) if it checks out correct change the password.

 

hope the explaining was useful

 

Hey rajiv, long time no see,

 

anyway for a password reset you wouldnt check it against the current password as they have forgotten it. simply add a field email or something similar, basically just another identification string that is included in the url so they cant guess them

 

 

doing good sorry about that I totally did not see it was a forgot password lol, you could reset the password and send it some random generated password as mentioned above I think that will be the best

Link to comment
https://forums.phpfreaks.com/topic/183249-please-help/#findComment-967522
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.