The next thing we need to do is create the p checked out BHP page that will check the email and password
against the database for a match so open a new file and save it as P check the IP HP
inside your perfect cup folder
so we'll start with our open and close p p tags
next we'll set up the session start function.
And this is because later in the script we'll create some session variables.
We also need to retrieve the email and password supplied by the user
using the post method.
Next we create the database connection to our perfect cop database
we then run a query on the members table to check if the email address already exists.
So select RECORDS FROM members WHERE email equals the email variable and we'll store the query in a
result variable.
We then need to get the number of rows attached to the contents of the result variable.
If the number of rows is greater than or equal to 1.
This tells us that the email address does exist in the system.
We then use the built in password verify function to UN hash the encrypted password in our database.
We then compare the contents of the password variable to the UN hashed password.
If the two passwords match we create three session variables.
The first is log in which will store the user's I.D. and their first name in larceny.
The reason we do this is to keep the user logged in until they decide to log out or close their browser.
So there's there's really two ways of triggering these session variables.
First if the user just registered and we did that earlier or if the user logs in.
So in both scenarios these three session variables are created.
If the entire process is executed we echo the text.
True.
And so that's a success code which is transmitted back to the log in page.
If the email address already exists or if the password verification failed in both these situations
we output the error code.
False and again that is also sent back to the log in page.