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. A lower-level value cannot override a higher-level value. 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.
Here is an example:
if (!session_is_registered("username")) {
$user_name= "";
session_register("username");
}
Above, also ensure that in your php.ini, variables_order = "GPCS" (default) S means session should be placed last and take priority.
register_globals = On is a waste of system resources and is turned off in the optimized configuration, which also avoids so-called vulnerabilities.
The above introduces the precautions when using session for customer verification in PHP, including the content of session and customer verification. I hope it will be helpful to friends who are interested in PHP tutorials.