note 26633 deleted from language.variables.predefined by philip
| From: | philip@php.net | Date: | Sun, 08 Dec 2002 02:04:47 +0000 |
| Subject: | note 26633 deleted from language.variables.predefined by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-40496@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