1
0
mirror of https://github.com/php/web-php.git synced 2026-04-24 15:38:06 +02:00
Files
archived-web-php/include/prepend.inc
T
Gabor Hojtsy 0f0ea9a2ff Removing geoip include to make pages run quicker.
Also adding comment into geoip include file, that
it is there for future use (not left there from
sometime from the past).
2002-12-21 13:39:30 +00:00

76 lines
2.2 KiB
C++

<?php // -*- C++ -*-
// Prevent cross site scripting problems
unset($RSIDEBAR_DATA);
unset($SIDEBAR_DATA);
// Backward compatible array creation. After this point, the
// PHP 4.1.0+ arrays can be used to access variables coming
// from outside PHP. But it should be noted that these variables
// are not necessarily superglobals, so they need to be global-ed!
if (!isset($_SERVER)) {
$_GET = &$HTTP_GET_VARS;
$_POST = &$HTTP_POST_VARS;
$_ENV = &$HTTP_ENV_VARS;
$_SERVER = &$HTTP_SERVER_VARS;
$_COOKIE = &$HTTP_COOKIE_VARS;
$_REQUEST = array_merge($_GET, $_POST, $_COOKIE);
}
// Put the magic quotes setting to $MQ
$MQ = (boolean) get_magic_quotes_gpc();
// Load in always required parts
include_once 'site.inc';
include_once 'layout.inc';
// This file is generated on rsync.php.net and propogated
// from there. It just defines $LAST_UPDATED, which is the
// mirror's last updated time.
include_once 'last_updated.inc';
// Function used to import request vars to global scope.
// Walks through $array, and imports all values associated
// with elements listed in $keys to the global scope
function import_vars(&$array, $keys)
{
// Wrong parameters passed
if (!is_array($array) || !is_array($keys)) { return FALSE; }
// Walk through all requested keys
foreach ($keys as $keyname) {
// If there is a value in the arary for this key,
// import it to the global scope (without copying)
if (isset($array[$keyname])) {
$GLOBALS[$keyname] = &$array[$keyname];
}
}
// Sign of success
return TRUE;
}
// Unset all variables except common ones we use
// to access request variables and the globals array
// If all files are register_globals = off safe, then
// this function can be called to get rid of all
// variables, even if register_globals = on
function unset_variables()
{
// Protect some common variables
$protected = array(
'_GET', '_POST', '_COOKIE', '_SERVER',
'_ENV', '_REQUEST', 'GLOBALS',
);
// Go through all global variables
foreach ($GLOBALS as $name => $value) {
if (!in_array($name, $protected)) {
unset($GLOBALS[$name]);
}
}
}
?>