note 26633 added to language.variables.predefined

From: Date: Thu, 07 Nov 2002 20:10:33 +0000
Subject: note 26633 added to language.variables.predefined
Groups: php.notes 
Request: Send a blank email to php-notes+get-39098@lists.php.net to get a copy of this message
Having fun converting pre-(_POST,_VAR,_ETC) code to post (_POST,_VAR,_ETC) code? Me too. Maybe somebody will appreciate this simple bit of code, add search and replaces as needed- <? $directory = opendir ( "./" ); while ( $filename = readdir($directory) ) { echo "opening <b>" . $filename . "</b> for search and replace.<br />\n"; $file = fopen ( $filename,"r" ); $text = fread ( $file,1000000 ); fclose ( $file ); $text = str_replace ( "HTTP_POST_VARS","_POST",$text ); $text = str_replace ( "HTTP_GET_VARS","_GET",$text ); $text = str_replace ( "HTTP_SESSION_VARS","_SESSION",$text ); $text = str_replace ( "\$PHP_SELF","\$_SERVER['PHP_SELF']",$text ); $text = str_replace ( "\$REQUEST_METHOD","\$_SERVER['REQUEST_METHOD']",$text ); $file = fopen ( $filename,"w" ); fwrite ( $file,$text ); fclose ( $file ); } ?> done -- http://www.php.net/manual/en/language.variables.predefined.php http://master.php.net/manage/user-notes.php?action=edit+26633 http://master.php.net/manage/user-notes.php?action=delete+26633 http://master.php.net/manage/user-notes.php?action=reject+26633

« previous php.notes (#39098) next »