Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Can I make register,login?

Im curious if I can make register/login and some user menu website if I finish full PHP Development track? If I learn everything from there, can I create register/login and others small things without googling? Im begginer, I dont know so much about PHP, just curious if I can do this when i finish this track..Or I need something more to learn? I know css and html.

2 Answers

For the most part… However, you'll want to google password HASH and PASSWORD_VERIFY for retrieving encrypted passwords. You'll need some SQL and PHP knowledge gained from the track to validate usernames and redirect to pages of your choosing filled in with $_POST or $_GET variables that populate fields that pertain to the specific user account.

Essentially, you'll make an HTML form with a username and password field, run a query against their $_POST variables, set error messages if the username and password don't match anything on record and redirect to the landing page if both username and password pass.

Kristian Egebæk-Carlsen
Kristian Egebæk-Carlsen
9,189 Points

There are a many different ways to create a login, of course if you want it to be super secure, this narrows down the possibilities. What you need to understand about a login is that it is quite simple logic behind it. You have a user put in a name and password, and then you have to check whether the user is in the system, and that the password is correct. Now the question is here where to store the users. If you have completed the PHP track, you will know that the catalog page you made, it got all the data from an array. You could do the same with a login, and array that contains keys and values where keys are the users and values are the password, when ever a user request to login, you have a function that iterates the array and if there is a key-value pair that matches the input, then a login can be made. Of course this is tedious and not very secure, but I hope you understand the idea behind it. All you need is a datastructure that allows you to store the user data and a method to call this datastructure, then you can create a login.