Lukas' Notes

web programming-languages

Definition

PHP

PHP is a server-side scripting language widely used for the Web — reportedly powering around 72% of sites. It is commonly embedded directly into HTML: variables start with $, string concatenation uses the dot ., and code sits between <?php … ?> tags.

Superglobals

Superglobal associative arrays

Superglobals are built-in associative arrays available throughout a PHP script. The most important ones are:

ArrayContents
$_GETparameters of the query string (URL)
$_POSTparameters submitted in a POST request body
$_SESSIONvalues stored in the current [[Knowledge/HTTP Cookie
$_COOKIEcookies sent by the client
$_FILESmetadata of uploaded files

Because they come straight from the client, $_GET and $_POST are the usual entry points for SQLi, command, path-traversal, and SSRF attacks, and must never be used unsanitised.