From c42b75d1bc1154c849b5f55becfc42452242c86d Mon Sep 17 00:00:00 2001 From: Graham Eames Date: Sun, 1 Oct 2006 11:10:15 +0000 Subject: Prevent cookies from other applications interfering with our forms git-svn-id: file:///svn/phpbb/trunk@6423 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/functions.php') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index fb0258996c..6093976084 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -52,8 +52,17 @@ function set_var(&$result, $var, $type, $multibyte = false) * * Used to get passed variable */ -function request_var($var_name, $default, $multibyte = false) +function request_var($var_name, $default, $multibyte = false, $cookie = false) { + if (!$cookie && isset($_COOKIE[$var_name])) + { + if (!isset($_GET[$var_name]) && !isset($_POST[$var_name])) + { + return (is_array($default)) ? array() : $default; + } + $_REQUEST[$var_name] = isset($_POST[$var_name]) ? $_POST[$var_name] : $_GET[$var_name]; + } + if (!isset($_REQUEST[$var_name]) || (is_array($_REQUEST[$var_name]) && !is_array($default)) || (is_array($default) && !is_array($_REQUEST[$var_name]))) { return (is_array($default)) ? array() : $default; -- cgit v1.2.1