note 33291 added to security.registerglobals

From: Date: Sat, 21 Jun 2003 02:28:16 +0000
Subject: note 33291 added to security.registerglobals
Groups: php.notes 
Request: Send a blank email to php-notes+get-50776@lists.php.net to get a copy of this message
This code below will override register_globals to a extent, this should only be used with old code that is hard or imposible to change. <?php /* * Code made by: MPHH */ while (list($vn, $vv)=each($_COOKIE)) { if (!isset($$vn)) { $$vn=$vv; } } while (list($vn, $vv)=each($_POST)) { if (!isset($$vn)) { $$vn=$vv; } } while (list($vn, $vv)=each($_GET)) { if (!isset($$vn)) { $$vn=$vv; } } ?> if $_SESSION is needed than before: while (list($vn, $vv)=each($_COOKIE)) { Add: while (list($vn, $vv)=each($_SESSION)) { if (!isset($$vn)) { $$vn=$vv; } } Very simple. ---- Manual Page -- http://www.php.net/manual/en/security.registerglobals.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33291 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33291&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33291&report=yes

« previous php.notes (#50776) next »