Welcome to the 5th part of the User registration tutorial.
We are going to tidy up a few bits and pieces together in our registration login process.
Then we'll give a full test to see if it really works.
In the last part, you saw that I registered myself in this database.
Everything has worked out fine and I am at the login screen here.
Lets see if I can login. Let's say username is "alex" and my password is the password that I used.
I can see that when I click in login, again, "Incorrect password".
This doesn't mean that my username hasn't been found.
Let me type this in username and type in my password.
It will tell me that user doesn't exit.
But here, it is saying that my username does exist but my password is wrong.
Now, the reason my password is wrong is that my plain text password here is being compared to my "md5-encrypted" password inside my data base.
The way we do this is, we go back to our login page, which we covered in the previous tutorial - the userlogin tutorial.
At the part where we compare our passwords to check if they match.
That's checking our username there and this is checking our password.
We need to check our password. At the moment, let's say I typed in my password as "slicer u k 1".
So, this is the password I am typing in here. Its quite an odd one.
"slicer u k 1". Okay and this is checking this and this password here is equal to slicer u k1.
But this "password" is equal "dbpassword". So we are not getting the comparison.
We get to choose this when we encrypt our password.
So now this will actually be equal to this, so this is encrypted "slicer u k 1", which is equal to this "slicer u k 1".
So we are comparing an md5 encrypted password to an md5 encrypted password in our database.
Let me resubmit this form again Oh! error again!
Let me try again. Click on login. No, its not working.
Let's check this. "password" equals to "POST password" so md5 is the password.
Let me go back and refresh this.
I type my password. Al-right, I know what the problem is here.
The problem here is that our md5 password is absolutely correct but it is being compared to a password which is cut short in our database.
That's because if we go to our structure and go down to our password field here and edit this, we have currently got a length of 25 as its limit.
So we are going increase the limit for this to, say, 100.
I am not exactly sure how long an md5 string is, but I will say length value = 100. Save that.
I am going to browse our table and delete this value. Then I am going to go back and re-register.
So, register. Choose your username.
Let's say "alex", like I said before. Choose a password, let's say "slicer u k 1". And I will click "Register".
"You have been registered. Return to login page".
Now, let's check our database again.
This is looking longer already, it hasn't been cut short because I have changed the length of this.
So now when I try to log back in and let me type this properly.
We can login and we are in. Okay so check things like string length.
Hopefully you have got this.
If you want me to expand this tutorial please just let me know.
And that is user registration.
This is followed on from our user login tutorial.
So by putting these together, we have got a fully functional user register and login process.
I will be using this in a lot of my project work. Say for example.
I might create a project on something that uses a user login and user registration. So I will be using this a lot.
So check my projects on user login and registration for more information.
If you have any questions or would like me to expand on anything, please just let me know.
border=1