diff --git a/ba-simple-proxy.php b/ba-simple-proxy.php index b1fa6e8..0b70503 100644 --- a/ba-simple-proxy.php +++ b/ba-simple-proxy.php @@ -164,7 +164,7 @@ curl_setopt( $ch, CURLOPT_POSTFIELDS, $_POST ); } - if ( $_GET['send_cookies'] ) { + if (isset($_GET['send_cookies']) && $_GET['send_cookies'] ) { $cookie = array(); foreach ( $_COOKIE as $key => $value ) { $cookie[] = $key . '=' . $value; @@ -181,7 +181,7 @@ curl_setopt( $ch, CURLOPT_HEADER, true ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); - curl_setopt( $ch, CURLOPT_USERAGENT, $_GET['user_agent'] ? $_GET['user_agent'] : $_SERVER['HTTP_USER_AGENT'] ); + curl_setopt( $ch, CURLOPT_USERAGENT, isset($_GET['user_agent']) && $_GET['user_agent'] ? $_GET['user_agent'] : $_SERVER['HTTP_USER_AGENT'] ); list( $header, $contents ) = preg_split( '/([\r\n][\r\n])\\1/', curl_exec( $ch ), 2 ); @@ -193,7 +193,7 @@ // Split header text into an array. $header_text = preg_split( '/[\r\n]+/', $header ); -if ( $_GET['mode'] == 'native' ) { +if (isset($_GET['mode']) && $_GET['mode'] == 'native' ) { if ( !$enable_native ) { $contents = 'ERROR: invalid mode'; $status = array( 'http_code' => 'ERROR' ); @@ -214,7 +214,7 @@ $data = array(); // Propagate all HTTP headers into the JSON data object. - if ( $_GET['full_headers'] ) { + if (isset($_GET['full_headers']) && $_GET['full_headers'] ) { $data['headers'] = array(); foreach ( $header_text as $header ) { @@ -226,7 +226,7 @@ } // Propagate all cURL request / response info to the JSON data object. - if ( $_GET['full_status'] ) { + if (isset($_GET['full_status']) && $_GET['full_status'] ) { $data['status'] = $status; } else { $data['status'] = array(); @@ -251,4 +251,4 @@ } -?> +?> \ No newline at end of file