Jump to content


Photo

secure log in


  • Please log in to reply
3 replies to this topic

#1 cfemocha

cfemocha
  • Members
  • PipPip
  • Member
  • 19 posts

Posted 09 March 2006 - 02:02 PM

I've been creating login pages by matching its username and password with the database and just wondering how is secure log in form differ from the method I've been using?

How would I create a secure login/registration form?

any help is appreciated.
Thank you.

#2 littlened

littlened
  • Members
  • PipPipPip
  • Advanced Member
  • 34 posts

Posted 09 March 2006 - 02:09 PM

[!--quoteo(post=353243:date=Mar 9 2006, 02:02 PM:name=cfemocha)--][div class=\'quotetop\']QUOTE(cfemocha @ Mar 9 2006, 02:02 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
I've been creating login pages by matching its username and password with the database and just wondering how is secure log in form differ from the method I've been using?

How would I create a secure login/registration form?

any help is appreciated.
Thank you.
[/quote]

I would image that you would put the login pages on the https side of your server, so your login page might be [a href=\"https://www.yoursite.com/login.php\" target=\"_blank\"]https://www.yoursite.com/login.php[/a] as I believe everything that's done over https is encrypted.

The other problem you would have though, is that the data stored in the database wouldnt be encrypted, so you would probably need to find an encryption script to encrypt the password before it stores in the the database, then decrypt the password when someone tries to login.

So basically the https would mean the data transfered from the users browser to your server would be encrypted, and the password in the database would be encrypted also.


#3 cfemocha

cfemocha
  • Members
  • PipPip
  • Member
  • 19 posts

Posted 10 March 2006 - 09:13 AM

Thank you so much for the reply.
I might be asking silly questions here but I have my login page in http://www.mysite.com/login.php NOT https, what do i need to do to have it move to https?
Also, if i encrypted all user data then does that mean I can't have a "remind password" function for users?

I see sometimes websites send out new generated passwords for users that forget their passwords instead of sending them their old ones, is this method more secure?

#4 lessthanthree

lessthanthree
  • Members
  • PipPipPip
  • Advanced Member
  • 85 posts
  • LocationUK

Posted 10 March 2006 - 09:21 AM

The method is indeed more secure.

Most sites with any security knowledge at all would be set up to hold the password in the database with an irreversible hashed value (using md5 / sha1 or some other encryption method). Yes these can be bruteforced or dictionary attacked but it's much safer than storing passwords in plain text.

Conveniently PHP has both an md5() and a sha1() function built in.

A new password has to be generated when a user has forgotten theirs as the one stored is hashed and cannot be decrypted.

The usual process for it is for the site to generate a new random password, email out a plain text version to the users stored email address, hash the password and insert it into the db.

You will have most likely noticed that the emails almost always reccomend that the user change their password once they have logged in with the newly generated once.
call me a safe bet, i'm betting i'm not




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users