PHP userid and password validation for user loginHere we will discuss about the checking of login id and password against the data in the signup table. This part of the code is given in the loginck.php file given inside the zip file which you can download at the end of this tutorial. You can go to part 1 of this script which displays the login form for the members to enter userid and password.
Advance Signup Script
This is a basic script and it requires knowledge of PHP , MySQL.
You can check our advance Signup - Login script using PHP, MySQL, JQuery & Bootstrap.
You can try plus-signup-v2 and visit this page again.
Here we have used the same plus_signup table we used in our php signup script tutorial so you can use all the files to develop a signup and login application.
We will use one line of SQL query to get the reply. We will be using select query to get the data from the table
plus_signup is the table name, userid and password are the field names. This SQL statement will return us one record if member userid and password is there in our table. So we can use one if condition to process the script if the usrid and password is correct and is there in the table.
We are using userid and password variables in our sql statement and using that to get data from our member table, it is not safe to directly use them inside query. We will use pdo to sanitize the data before using them. Let us first collect them
Now let us check the database with our query.
Here is the code to do all this for us.
In the above code if the validation is correct then we are creating session variables
The else condition if userid or password is not correct will display the message and ask the member to try again.
That's all for our member login script.
Using the session variable we can show other pages or redirect the members to different pages.
PHP Session: Creating , using destroying Session variables PHP Session ID: generating session id and re-generating Online membership management script Posting Activation key for lost encrypted password to the email address Creating a signup page and storing member details in MySQL Storing signup data in a table Changing or updating password by the logged in member Forgot password feature in member signup script Basic login form Login script to authenticate user from a mysql table data Checking the status of user for login or logged out Updating member profile inside member area Adding Profile Photo by Members after login Finding out who are online