note 16111 deleted from language.variables.external by irc-html
| From: | irc-html@php.net | Date: | Sat, 19 Jan 2002 19:03:18 +0000 |
| Subject: | note 16111 deleted from language.variables.external by irc-html | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-25223@lists.php.net to get a copy of this message | ||
I realized that many of PHP projects shared in the web are written track_vars set off and in my
configuration I allways turn them on. So here is a little script that switches the $HTTP_POST_VARS,
$HTTP_GET_VARS and $HTTP_POST_FILES to a form that they would be used when track_vars was set off:
<?php
/* Ari Kuorikoski
ari.kuorikoski@finebyte.com
http://www.finebyte.com
*/
/*==================================================
Transform $HTTP_GET_VARS["index"] = "value"
to $index = "value"
==================================================*/
if (!empty($HTTP_POST_VARS)) {
while (list($key, $value) = each ($HTTP_POST_VARS)) {
$a = $key;
$$a = $value;
}
}
/*==================================================
Transform $HTTP_GET_VARS["index"] = "value"
to $index = "value"
==================================================*/
if (!empty($HTTP_GET_VARS)) {
while (list($key, $value) = each ($HTTP_GET_VARS)) {
$a = $key;
$$a = $value;
}
}
/*==================================================
Transform $HTTP_SESSION_VARS["index"] = "value"
to $index = "value"
==================================================*/
if (!empty($HTTP_SESSION_VARS)) {
while (list($key, $value) = each ($HTTP_SESSION_VARS)) {
$a = $key;
$$a = $value;
}
}
/*==================================================
Transform $HTTP_POST_FILES["index"]["index2"] = "value"
to $index_index2 = "value"
==================================================*/
if (!empty($HTTP_POST_FILES)) {
while (list($key, $value) = each ($HTTP_POST_FILES)) {
if (!is_array($value)){
$a = $key;
$$a = $value;
}
else {
while (list ($aKey, $aValue) = each($value)) {
if ($aKey != 'tmp_name') {
$b = $key ."_".$aKey;
$$b = $aValue;
}
else {
// temporary filename
$b = $key;
$$b = $aValue;
}
}
}
}
}
/*==================================================
Transform $HTTP_SESSION_VARS["index"] = "value"
to $index = "value"
==================================================*/
if (!empty($HTTP_SESSION_VARS)) {
while (list($key, $value) = each ($HTTP_SESSION_VARS)) {
$a = $key;
$$a = $value;
}
}
/*==================================================
Transform $HTTP_ENV_VARS["index"] = "value"
to $index = "value"
==================================================*/
if (!empty($HTTP_ENV_VARS)) {
while (list($key, $value) = each ($HTTP_ENV_VARS)) {
$a = $key;
$$a = $value;
}
}
/*==================================================
Transform $HTTP_COOKIE_VARS["index"] = "value"
to $index = "value"
==================================================*/
if (!empty($HTTP_COOKIE_VARS)) {
while (list($key, $value) = each ($HTTP_COOKIE_VARS)) {
$a = $key;
$$a = $value;
}
}
/*==================================================
Transform $HTTP_SERVER_VARS["index"] = "value"
to $index = "value"
==================================================*/
if (!empty($HTTP_SERVER_VARS)) {
while (list($key, $value) = each ($HTTP_SERVER_VARS)) {
$a = $key;
$$a = $value;
}
}
?>