Update killglobals.php
[iDB.git] / inc / misc / killglobals.php
blobe513a91fb964d4b2f33ddc094bd8f18ed44a7f62
1 <?php
2 /*
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the Revised BSD License.
6 This program is distributed in the hope that it will be useful,
7 but WITHOUT ANY WARRANTY; without even the implied warranty of
8 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 Revised BSD License for more details.
11 Copyright 2004-2023 iDB Support - https://idb.osdn.jp/support/category.php?act=view&id=1
12 Copyright 2004-2023 Game Maker 2k - https://idb.osdn.jp/support/category.php?act=view&id=2
13 Kill Register Globals (Register Globals are very lame we dont need them anyways. :P)
15 $FileInfo: killglobals.php - Last Update: 6/22/2023 SVN 984 - Author: cooldude2k $
17 $File3Name = basename($_SERVER['SCRIPT_NAME']);
18 if ($File3Name=="killqlobals.php"||$File3Name=="/killqlobals.php") {
19 require('index.php');
20 exit(); }
22 function unregister_globals() {
23 if (ini_get('register_globals')) {
24 $REQUEST = $_REQUEST;
25 $GET = $_GET;
26 $POST = $_POST;
27 $COOKIE = $_COOKIE;
28 if(isset($_SESSION)) {
29 $SESSION = $_SESSION; }
30 $FILES = $_FILES;
31 $ENV = $_ENV;
32 $SERVER = $_SERVER;
33 foreach($GLOBALS as $key => $value) {
34 if($key!='GLOBALS') {
35 unset($GLOBALS[$key]); } }
36 $_REQUEST = $REQUEST;
37 $_GET = $GET;
38 $_POST = $POST;
39 $_COOKIE = $COOKIE;
40 if(isset($SESSION)) {
41 $_SESSION = $SESSION; }
42 $_FILES = $FILES;
43 $_ENV = $ENV;
44 $_SERVER = $SERVER; } }
45 unregister_globals();
46 *//*
47 unction unregister_globals() {
48 if (ini_get('register_globals')) {
49 foreach (array('_REQUEST', '_GET', '_POST', '_COOKIE', '_FILES', '_ENV', '_SERVER') as $superglobal) {
50 foreach ($GLOBALS[$superglobal] as $key => $value) {
51 unset($GLOBALS[$key]);
54 if (isset($_SESSION)) {
55 foreach ($_SESSION as $key => $value) {
56 unset($GLOBALS[$key]);
61 unregister_globals();
63 function unregister_globals_advanced() {
64 if (ini_get('register_globals')) {
65 $superglobals = array('_REQUEST', '_GET', '_POST', '_COOKIE', '_SESSION', '_FILES', '_ENV', '_SERVER');
66 foreach ($GLOBALS as $key => $value) {
67 if (!in_array($key, $superglobals) && $key != 'GLOBALS') {
68 unset($GLOBALS[$key]);
73 unregister_globals_advanced();