Skip to Content
Programming PHP
book

Programming PHP

by Rasmus Lerdorf, Kevin Tatroe
March 2002
Intermediate to advanced
528 pages
21h 29m
English
O'Reilly Media, Inc.
Content preview from Programming PHP

Variables

Server configuration and request information—including form parameters and cookies—are accessible in three different ways from your PHP scripts, as described in this section. Collectively, this information is referred to as EGPCS (environment, GET, POST, cookies, and server).

If the register_globals option in php.ini is enabled, PHP creates a separate global variable for every form parameter, every piece of request information, and every server configuration value. This functionality is convenient but dangerous, as it lets the browser provide initial values for any of the variables in your program. The (negative) effects this can have on your program’s security are explained in Chapter 12.

Regardless of the setting of register_globals, PHP creates six global arrays that contain the EGPCS information.

The global arrays are:

$HTTP_COOKIE_VARS

Contains any cookie values passed as part of the request, where the keys of the array are the names of the cookies

$HTTP_GET_VARS

Contains any parameters that are part of a GET request, where the keys of the array are the names of the form parameters

$HTTP_POST_VARS

Contains any parameters that are part of a POST request, where the keys of the array are the names of the form parameters

$HTTP_POST_FILES

Contains information about any uploaded files

$HTTP_SERVER_VARS

Contains useful information about the web server, as described in the next section

$HTTP_ENV_VARS

Contains the values of any environment variables, where ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming PHP, 3rd Edition

Programming PHP, 3rd Edition

Rasmus Lerdorf, Kevin Tatroe, Peter MacIntyre
Programming PHP, 2nd Edition

Programming PHP, 2nd Edition

Rasmus Lerdorf, Kevin Tatroe, Peter MacIntyre
Clean Code in PHP

Clean Code in PHP

Carsten Windler, Alexandre Daubois

Publisher Resources

ISBN: 1565926102Supplemental ContentCatalog PageErrata