To use variables set outside a function you will either have to pass them as arguments to the function or use the global statement to get them into the function.
If global isn't used on these variables, the script wouldn't find any info at all:
global $HTTP_POST_VARS, $HTTP_GET_VARS, $HTTP_COOKIE_VARS, $HTTP_SESSION_VARS;
These variables on the other hand, were introduced in PHP 4.1.0 and are called Superglobals, and to use them you don't actually need to use global:
global $_POST, $_GET, $_COOKIE, $_SESSION;
They store the same information as the variables above but only work in PHP 4.1.0 and above (and you can use them anywhere in the script, unlike the other ones).
Magic Quotes is a setting in PHP which adds slashes to quotes in strings read from the GET and POST variables. If magic quotes is turned off you will have to use the function addslashes() to any content read from the browser before inserting it into a database. Since this is a server setting, threads removes the slashes if they are turned on, and takes care of adding them on its own when necessary.