Hi, this was a great section. Gone through it a few times now to try get to grips with it. Almost there.
It strikes me how thorough you need to be in order to code a 'simple' user authentication page.
I changed a few things. For one I did not like the page1.php file name reference. It made more sense for me to call it signin.php. So when you 'login' the resultant php file would either be 'signin.php' or 'signup.php'.
I never knew that so much goes into a login page,i thot it was just an if-else statement, got to learn on sessions which is still tricky, but will go over and over this topic till i am good to go
Really like this walkthrough, good to see how everything we've learnt in the previous chapters are coming together and how we can use it in the real world.
Hi there all,
I just noticed in this login walkthrough that I was able to register a user name that does not adhere to the limitations in the code >=10 and <=20. Is my conclusion correct that this happens because the same errorMessage variable is used for the user name and password, so if the password is the correct length the errorMessage is set to blank, even though the user name is still too short/long? Would I also be correct to think the solution to this shortcoming would be to use a different errorMessage for the user name and password? Or would a better solution be to change the if-statement to combine the checking of the user name and password?
Cheers!
Admin
Registered: 18 years ago
Posts: 10,001
Rating: 353
I have not tried its myself, but your logic appears to be 100%. Since a user must enter both, start of with user name and nest password within the user name brackets.