so I’m new to PHP, and I wanna understand the basic server authentication process for a web login form.
- User types in details into the input elements
- Javascript to validate content typed in
- Here is where it gets blurry – PHP takes the value of the input fields, and checks if there’s a similar username in the DB…
- If there is, then it compares the passwords, and if there’s a match, proceed, otherwise trigger a javascript function to show ‘wrong credentials’ to the user
Now, for step 3:
I know I need to use PHP to execute a SQL query that goes like:
SELECT * FROM users WHERE user_name like $input_user
But what do you do about this? I seem to not understand the basics here, I think I need a tutorial. 🙁
You need to authenticate the user with his username and password.
Now the $_SESSION[“member_id”] is available in all your pages. Look at the below link on more information about this.
http://www.tutorialized.com/tutorial/Create-a-Log-in-out-System-or-Script-for-a-Webpage.-UPDATED/69498
http://www.codewalkers.com/c/a/Miscellaneous/Writing-a-Basic-Authentication-System-in-PHP/
Of course you coulda easily googled this out!