Hack Forums
[PHP] Need a guide to make a secure login/register system - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Web Development (https://hackforums.net/forumdisplay.php?fid=183)
+---- Thread: [PHP] Need a guide to make a secure login/register system (/showthread.php?tid=2220537)



Need a guide to make a secure login/register system - Webman.io - Feb 17, 2012

I need a guide on how to make a secure login/register system in PHP.

Does anyone knows a good one?


* - Haxalot - Feb 17, 2012

If you prefer to watch videos whilst learning, then this site is pretty good.

http://thenewboston.org/list.php?cat=11
Video numbers 136 to 147 are the logging in/registration tutorials.

PHPAcademy also provide videos on how to do so:
http://www.youtube.com/watch?v=4oSCuEtxRK8&list=PL7C9AFC3942AC8E40&feature=plcp&context=C3241f75FDOEgsToPDskIdpBu_W40OlpurLrTqPRsX

If you would like any further help, then you can send me a pm and i will help guide you.


* - HyperText - Feb 17, 2012

You will need to know how to use MySQL, and MySQL in php. Its actually kinda easy once you get the hang of it.


* - Toph Beifong - Feb 17, 2012

just use PHP academy, he has a good set of tutorials, including login and registration.


* - Fire - Feb 17, 2012

Yeah, like the other said, PHPacademy is awesome to start with, he explains each and every line of code.


* - Uncomplicated - Feb 17, 2012

I'm seeing too many NewBoston recommendations.

@OP my recommendation: PHP academy

Here's what I do...

- Validate captcha
- See if he has accepted terms
- Check if everything has been submitted
- Sanitize everything
- Check if username has a valid length i.e. b/w 3 - 20
- Check is password is longer than 6 characters
- Check is username doesn't has anything except letters, numbers, underscore and a dash
- Check if email is valid
- Add more checks depending on website like valid credit card number?
- Check if email has been already used
- Check if username has been already taken

All Good -> Hash password -> Insert into user table -> Check if insert was successful -> Display result -> Redirect