note 87101 added to security.globals

From: Date: Wed, 19 Nov 2008 11:38:34 +0000
Subject: note 87101 added to security.globals
Groups: php.notes 
Request: Send a blank email to php-notes+get-146699@lists.php.net to get a copy of this message
your webspace provider has register-globals activated by standard and you don't have a chance to turn it off? no problem anymore, here is your solution... <?php // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ // this is just a workaround to kill all through register globals imported vars! // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ // place this script after session_start() to be sure you unregister_globals('_SESSION'); // that's all, now all through "register_globals" assigned vars are deleted from scope. // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ if (ini_get('register_globals') == 1) { if (is_array($_REQUEST)) foreach(array_keys($_REQUEST) as $var_to_kill) unset($$var_to_kill); if (is_array($_SESSION)) foreach(array_keys($_SESSION) as $var_to_kill) unset($$var_to_kill); if (is_array($_SERVER)) foreach(array_keys($_SERVER) as $var_to_kill) unset($$var_to_kill); unset($var_to_kill); } ?> hope you like it ;) greetz subarea   ---- Server IP: 212.124.37.9 Probable Submitter: 212.184.199.164 ---- Manual Page -- http://www.php.net/manual/en/security.globals.php Edit -- https://master.php.net/note/edit/87101 Del: integrated -- https://master.php.net/note/delete/87101/integrated Del: useless -- https://master.php.net/note/delete/87101/useless Del: bad code -- https://master.php.net/note/delete/87101/bad+code Del: spam -- https://master.php.net/note/delete/87101/spam Del: non-english -- https://master.php.net/note/delete/87101/non-english Del: in docs -- https://master.php.net/note/delete/87101/in+docs Del: other reasons-- https://master.php.net/note/delete/87101 Reject -- https://master.php.net/note/reject/87101 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#146699) next »