Home >Backend Development >PHP Tutorial >PHP user authentication Things to note when using session for client authentication
If register_globals = On in your php.ini, all post, get, cookie, and session variables with the same name will be mixed together. You can use $HTTP_*_VARS["username"] to determine which variable you want.
But Even if they have the same name, variables_order = "GPCS" in php.ini will be judged according to the priority level. Values with lower levels cannot override those with higher levels. Therefore, it is wise to use session_register("username") from the beginning. You can also use session_is_registered to determine whether the variable has been registered.
This is an example:
if (!session_is_registered("username")) {
$user_name= "";
session_register("username");
}
At the same time, ensure that you In php.ini, variables_order = "GPCS" (default) S means that session should be placed last and take priority.
register_globals = On is a waste of system resources and was turned off in the optimization configuration. This also avoids so-called loopholes.
The above introduces PHP user verification and precautions when using session for customer verification, including the content of PHP user verification. I hope it will be helpful to friends who are interested in PHP tutorials.