search
Homephp教程php手册php用session做客户验证时的注意事项

如果你的php.ini中register_globals = On, 所有post, get, cookie, session的同名变量就会搅和在一起, 可以用$HTTP_*_VARS["username"]来判断你想要的那个变量.

但是即使同名, 在php.ini中variables_order = "GPCS"也会按照优先级别来判断, 等级低的值没法冲掉等级高的. 所以, 如果一开始就用session_register("username")是明智的,也可以用session_is_registered来判断变量是否已经注册.

这是一个例子:

if (!session_is_registered("username")) {
    $user_name= "";
    session_register("username");
}

同时保证你的php.ini中, variables_order = "GPCS" (缺省) S即session要放在最后, 优先.

register_globals = On有些浪费系统资源, 在优化配置中被关掉, 这样也避免了出现所谓漏洞.



Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use