note 55596 added to security.globals

From: Date: Mon, 08 Aug 2005 15:08:11 +0000
Subject: note 55596 added to security.globals
Groups: php.notes 
Request: Send a blank email to php-notes+get-93251@lists.php.net to get a copy of this message
Instead of register globals If Your ini_set('register_globals',1) does not work, and You don't want to rewrite all your code, include this at the top of your page: $req=array_values($_REQUEST); for($i=0;$i<=count($_REQUEST);$i++) { $tmp="$".KeyName($_REQUEST,$i)."=\"".$req[$i]."\";"; eval($tmp); } function KeyName($myArray,$pos) { if ( ($pos < 0) || ( $pos >= count($myArray) ) ) return "NULL"; reset($myArray); for($i = 0;$i < $pos; $i++) next($myArray); return key($myArray); } This will make all HTTP request variables local (post and get), that were available for your script before. ---- Manual Page -- http://www.php.net/manual/en/security.globals.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+55596 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55596&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55596&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55596&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55596&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55596&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55596&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+55596&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#93251) next »