00001 <?php
00002
00003
00004
00014
00015
00016 if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS'])) {
00017 die("GLOBALS overwrite attempt");
00018 }
00019
00020 function PMA_gpc_extract($array, &$target, $sanitize = TRUE) {
00021 if (!is_array($array)) {
00022 return FALSE;
00023 }
00024 $is_magic_quotes = get_magic_quotes_gpc();
00025 foreach ($array AS $key => $value) {
00035 if ($sanitize && is_string($key) && (
00036 $key == 'cfg'
00037 || $key == 'GLOBALS'
00038 || substr($key, 0, 3) == 'str'
00039 || $key{0} == '_')) {
00040 continue;
00041 }
00042
00043 if (is_array($value)) {
00044
00045
00046 unset($target[$key]);
00047
00048 PMA_gpc_extract($value, $target[$key], FALSE);
00049 } else if ($is_magic_quotes) {
00050 $target[$key] = stripslashes($value);
00051 } else {
00052 $target[$key] = $value;
00053 }
00054 }
00055 return TRUE;
00056 }
00057
00058
00059 $__redirect = NULL;
00060 if ( isset( $_POST['usesubform'] ) ) {
00061
00062
00063 $subform_id = key( $_POST['usesubform'] );
00064 $subform = $_POST['subform'][$subform_id];
00065 $_POST = $subform;
00066 if ( isset( $_POST['redirect'] )
00067 && $_POST['redirect'] != basename( $_SERVER['PHP_SELF'] ) ) {
00068 $__redirect = $_POST['redirect'];
00069 unset( $_POST['redirect'] );
00070 }
00071 }
00072
00073
00074 if (!empty($_GET)) {
00075 PMA_gpc_extract($_GET, $GLOBALS);
00076 }
00077
00078 if (!empty($_POST)) {
00079 PMA_gpc_extract($_POST, $GLOBALS);
00080 }
00081
00082 if (!empty($_FILES)) {
00083 foreach ($_FILES AS $name => $value) {
00084 $$name = $value['tmp_name'];
00085 ${$name . '_name'} = $value['name'];
00086 }
00087 }
00088
00089 if (!empty($_SERVER)) {
00090 $server_vars = array('PHP_SELF', 'HTTP_ACCEPT_LANGUAGE', 'HTTP_AUTHORIZATION');
00091 foreach ($server_vars as $current) {
00092 if (isset($_SERVER[$current])) {
00093 $$current = $_SERVER[$current];
00094 } elseif (!isset($$current)) {
00095 $$current = '';
00096 }
00097 }
00098 unset($server_vars, $current);
00099 }
00100
00101
00102 if (isset($goto) && strpos(' ' . $goto, '/') > 0 && substr($goto, 0, 2) != './') {
00103 unset($goto);
00104 }
00105
00106 if ( ! empty( $__redirect ) ) {
00107
00108
00109 require('./' . preg_replace('@\.\.*@','.',$__redirect));
00110 exit();
00111 }
00112 ?>