Now, the first thing that we need to check is that we need to compare the password.
We compare the password with the confirmed password and make sure that they match.
So I'm going to say here, if and then if password is not equal to the confirmed password, then we
need to display an area.
We need to say header and then header and then location and then register that BHP and then I'm going
to pass a get parameter.
I'm going to say error.
So error is going to be equal to password.
Passwords don't match.
Don't match.
Matt.
And then I'm going to check another area, which is the length, the length of the passport.
So if the passport is a t r length.
Yes, they are linked.
And then passport is smaller than, let's say, six characters.
Then I'm going to tell you that you cannot use a password that's less than six characters.
So I'm going to say here, Heather again and then location and then register that BHP and then I'm going
to say error.
Is equal to password.
Must be at least.
Six.
Characters.
So let's display the these errors.
So how can you display these areas?
You can use the get browser as the above the form just below below the opening track of the form.
You can say here p paragraph and then you can use say B b2b and then you can see echo and then what?
What do we want to echo?
We want to actually get parameter, we get error, and then we need to give this paragraph a color.
I'm going to say style color red, because this is an error.
Let's this let's test this this part or let's continue first.
I think we need to contain you first because it's going to take some time.
So let me continue first and then we are going to test later.
So this is going to check whether if pass or don't match.
And here this is going to check.
A password is less than less than six characters.
Six characters.
And then if there is no error, you can, by the way, add many errors.
You can customize this depending on what you want to check.
But I think these are the most important things.
Then if there is no error, we can here start the registration process.
So their attention process is that we need to get these and then insert them into the database.
So to do this, we need to we need to start a connection, too.
So to start a connection, we need to include remember, we need to say here include and then we need
to include the server server for separate connection.
And then we need to use the connection variable.
We need to say here con and then we need to call a function called prepare, prepare.
And then we need to insert.
We need to insert.
Seared into we into what table?
Into the user's table.
We need to insert into the user's table this user's table, user ID, name, email and password.
So what I'm going to do is that I'm going to say insert into users.
And then what do we want to insert?
We want to insert the name, email and password, and the ID will be given by the database.
So we need to say the first one is user underscore name, user underscore name.
The second is user underscore email.
User underscore email.
The third is user underscore password and nearing to say values.
Values.
What are the values?
The values are question marks because I'm going to be using I'm going to be using the mind.
So I'm going to say here going I'm going to say here is statement.
I'm going to store this in a statement I'm going to say is the empty is equal to con and then I'm going
to use the statement and then I'm going to say bind param.
And the parameters are three parameters.
The are the username email and the password is SS and then we need to basically email the facility name
and then email and then password.
However, there are two important things that we need to do before this.
So these these two things are first, the password must be hacked.
So in order to have the password, we need to say here.
We need to say aim the fines and then pass the password.
This is going to hash the password.
This is very important and this is one of the best practices of BHP when it comes to security.
And if you want to find out more about best practices in BHP when it comes to security, you can take
my course about the best practices of BHP, the best of security practices at BHP.
I recommend I'd highly recommend taking this course because it's going to teach you the important things
that you need to take into account whenever you are working with P2P in order to avoid being hacked
and in order to protect your systems and your websites and your web applications.
Anyways, we need now to do a very important thing, which is check before doing this.
This is going to insert.
This is going to create a user, a new user.
However, before creating a new user, we need to check.
Check whether.
Whether.
There is a user with this email or not with this email or not because we cannot register the user with
many users with the same email.
So to do this, we need to create another statement.
We need to say Here, gone.
And then we need to say prepare, prepare and then select.
Select.
All from.
Users.
Where?
Where.
Email.
Is equal to a question mark.
And then I'm going to pass here the question mark.
I'm going to say.
Uh, is the empty one is equal to this.
And then I'm going to say stmd1 bind Baram.
And then s and then comma.
And then email.
And then I'm going to say here is the empty and then execute.
And then I'm going to say statement and then bind the result and then I'm going to say num underscore.
Right.
And then statement.
And then Fitch.
And then finally I'm going to say I'm going to check.
I'm going to say if numb.
Bras is not.
If it's not equal to zero, then we need to display an error.
So I'm going to say here, Hitler.
Hey there.
And then location and then register.
Got BHP and then air.
And then.
Use, I'm going to say user when this email already exists.
And here, by the way, we need to say count, count and then start, count, start, because we aren't
interested in getting information.
We are interested only in getting the number of rows we need to find, whether there's an email with
whether there's a user with this email or not.
If there is, then we need to stop emails.
We need to continue.
So here we need to see in location, register that BGP and display this area in case the number of rows
is not equal to zero.