php any help secure login


#1

i am beginning for php …so any help for how to create easily secure login in php …


#2

Using PDO (http://uk3.php.net/PDO)/MySQLi (http://uk3.php.net/mysqli) along with password_hash (http://uk3.php.net/password_hash) and password_verify (http://uk3.php.net/manual/en/function.password-verify.php) should be sufficient for a basic login.

Give it a try, if you have any problems, post your code and we’ll help you out.


#3

Thanks dude ur help nd also pls any sample php login examples for secure login using sessions …


#4

We’re not going to write code for you. Give it a go yourself and then ask for help.

As for sessions, set the session if the user is authenticated. There are lots of things you can set in the session, but I just use a user_id as it doesn’t hold any usable data. I then pull out the users information as-and-when.

More advanced systems may use different methods such as storing data in memcash, but I haven’t had the need for anything like that as of yet.


#5

You can actually just set up php.ini to store sessions directly in memcache, then you have a distributed memory based session handler for multiple servers :slight_smile: