Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-18-2009, 02:46 PM   PM User | #1
ridgey28
New Coder

 
Join Date: Jul 2008
Location: Aberdeenshire
Posts: 16
Thanks: 2
Thanked 0 Times in 0 Posts
ridgey28 is an unknown quantity at this point
Event Manager- Forgotten Password Page

Hi I am improving and modifying a simple event manager. The login form has a forgotten password link which obviously leads to the forgot password page. Is there anyway I can prevent direct access to the forgotten password file i.e. from someone being able to type http://yoursite.com/admin/forgotPass.php in the address bar?

Thanks in Advance

Tracy
ridgey28 is offline   Reply With Quote
Old 10-18-2009, 06:13 PM   PM User | #2
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,046
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
If there's a link to it already, what difference does it make?
Why is it a problem if someone enters it on the address bar?
mlseim is offline   Reply With Quote
Old 10-18-2009, 06:40 PM   PM User | #3
Phil Jackson
Senior Coder

 
Join Date: Aug 2009
Location: Mansfield, Nottinghamshire, UK
Posts: 1,547
Thanks: 57
Thanked 148 Times in 147 Posts
Phil Jackson is on a distinguished road
there is no plausible reason for why you would need to do this as stated above by mlseim. If your worried about "hack attempts" then secure your code to the best of your ability.
__________________
Website Design Mansfield
PHP Code:
function I_LOVE(){function b(&$b='P'){$b.='P';}function a($_){return $_++;}$b='P';define("B",'H');b($b=implode('',array($b=a($b),$b=a(B))));b($b);return $b;}
echo 
I_LOVE(); 
Phil Jackson is offline   Reply With Quote
Old 10-18-2009, 06:44 PM   PM User | #4
ridgey28
New Coder

 
Join Date: Jul 2008
Location: Aberdeenshire
Posts: 16
Thanks: 2
Thanked 0 Times in 0 Posts
ridgey28 is an unknown quantity at this point
It was just from a security point of view. The original script had a password reset function which sent a link to the users email address, the user would then click on the link which would take you to another page from which you can change your password. I have changed this to send the user a new encrypted password on input of an email address instead.
ridgey28 is offline   Reply With Quote
Old 10-18-2009, 06:45 PM   PM User | #5
Phil Jackson
Senior Coder

 
Join Date: Aug 2009
Location: Mansfield, Nottinghamshire, UK
Posts: 1,547
Thanks: 57
Thanked 148 Times in 147 Posts
Phil Jackson is on a distinguished road
straight into there mail box or on screen?
__________________
Website Design Mansfield
PHP Code:
function I_LOVE(){function b(&$b='P'){$b.='P';}function a($_){return $_++;}$b='P';define("B",'H');b($b=implode('',array($b=a($b),$b=a(B))));b($b);return $b;}
echo 
I_LOVE(); 
Phil Jackson is offline   Reply With Quote
Old 10-18-2009, 06:51 PM   PM User | #6
ridgey28
New Coder

 
Join Date: Jul 2008
Location: Aberdeenshire
Posts: 16
Thanks: 2
Thanked 0 Times in 0 Posts
ridgey28 is an unknown quantity at this point
to their email.
ridgey28 is offline   Reply With Quote
Old 10-18-2009, 06:53 PM   PM User | #7
CFMaBiSmAd
Senior Coder

 
CFMaBiSmAd's Avatar
 
Join Date: Oct 2006
Location: Denver, Colorado USA
Posts: 2,713
Thanks: 2
Thanked 251 Times in 243 Posts
CFMaBiSmAd is a jewel in the roughCFMaBiSmAd is a jewel in the roughCFMaBiSmAd is a jewel in the roughCFMaBiSmAd is a jewel in the rough
You should only replace the original password when the 'new' password gets used. This will prevent someone from going through a bunch of usernames on your site, requesting 'forgotten' passwords and causing the original passwords to be replaced with the 'new' ones.
__________________
If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.
CFMaBiSmAd is online now   Reply With Quote
Users who have thanked CFMaBiSmAd for this post:
ridgey28 (10-19-2009)
Old 10-18-2009, 07:16 PM   PM User | #8
ridgey28
New Coder

 
Join Date: Jul 2008
Location: Aberdeenshire
Posts: 16
Thanks: 2
Thanked 0 Times in 0 Posts
ridgey28 is an unknown quantity at this point
I see what you mean. Currently the username is the email address and when you click on the forgotten password link and enter the email address, it sends the the user with that email address a new password which is encrypted.

So you are saying instead of changing their password when they enter their email address correctly, send them a temporary password, let them log in with the temporary password then let them create a new password to overwrite the original password.

Would having a security question also improve security more? Do you recommend having an email address as a username or would you recommend having both?

Thanks for your help
ridgey28 is offline   Reply With Quote
Old 10-19-2009, 03:11 AM   PM User | #9
bazz
Master Coder

 
Join Date: Apr 2003
Location: in my house
Posts: 5,211
Thanks: 39
Thanked 201 Times in 197 Posts
bazz will become famous soon enoughbazz will become famous soon enough
I think what CFMaBiSmAd means (and I would agree), is that when you send the link to the member's email address, you make the thing work so that only when they click that link, will it change the db password value. Otherwise, some hacker could come along and change everyone's password such that they have to learn a new one, when they didn't want it to be changed.

Another thing.... why send the encrypted pwd to the email address? firstly, that route is not secure. also, I would suggest, the user wants a fairly easy to recall password and not a 32 character one.

So, basically, send them a link which works only for say 24hrs. that emans it will have a value which is changed every 24hrs. unless the value in that url matches, access to the change-my-password script cannot happen. once in that scipt, they can submit a new pwd and perhaps a security question and a prompt/aide memoire for it.

hth
bazz
__________________
"The day you stop learning is the day you become obsolete"! - my late Dad.

Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
Useful MySQL resource
Useful MySQL link
bazz is offline   Reply With Quote
Users who have thanked bazz for this post:
ridgey28 (10-19-2009)
Old 10-19-2009, 11:47 AM   PM User | #10
ridgey28
New Coder

 
Join Date: Jul 2008
Location: Aberdeenshire
Posts: 16
Thanks: 2
Thanked 0 Times in 0 Posts
ridgey28 is an unknown quantity at this point
Quote:
I see what you mean. Currently the username is the email address and when you click on the forgotten password link and enter the email address, it sends the the user with that email address a new password which is encrypted
Sorry I got that wrong. It sent the user a random password which is encrypted with md5 & $salt, in the database, not sent encrypted.
ridgey28 is offline   Reply With Quote
Reply

Bookmarks

Tags
php, security

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:30 PM.


Advertisement
Log in to turn off these ads.