folks.
I’m just starting with PHP and I’d like to get some guidance on developing a register/login system.
I’ve read that I should check if the method used to submit a form was POST.
The PHP code that is going to process the signup form should have a verification similar to:
if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') {...
if (isset($_POST['dosignup'])) { ... // submit button (working fine)
another if to check the integrity of the csrf token (working fine)
another if for header injection (working fine)
another if to check fields and do some validation, etc
I’m just not sure if that is not overkill nowadays.
Also, would it be proper to use $_POST=array(); and maybe unset any unnecessary $_SESSION variables after everything are saved on the database?
Again,
Since I’m just a dumb beginner I’m not sure what is okay and whatnot.
Rod Rodrigues is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2