Home > Backend Development > PHP Tutorial > Things to note when using session for customer verification in PHP

Things to note when using session for customer verification in PHP

WBOY
Release: 2016-08-08 09:34:07
Original
970 people have browsed it

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.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template