note 7304 deleted from function.strip-tags by jimw

From: Date: Mon, 29 Oct 2001 01:52:02 +0000
Subject: note 7304 deleted from function.strip-tags by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-19551@lists.php.net to get a copy of this message
New code for stripping tags from form input. The reason for the addition is that the original code gave me trouble when trying to pass arrays via a form. This seems to fix the problem: // Authors: // tomjr@tx3.net // jkeppens@xs4all.be // dsalada@adventassociates.com if(is_array($HTTP_POST_VARS)) { reset($HTTP_POST_VARS); while (list($key, $val) = each($HTTP_POST_VARS)) { if (is_array($val)) { while (list($akey,$aval) = each($val)) { $HTTP_POST_VARS[$key][$akey] = strip_tags($aval); $$key[$akey] = strip_tags($aval); } } else { $HTTP_POST_VARS[$key] = strip_tags($val); $$key = strip_tags($val); } } } if(is_array($HTTP_GET_VARS)) { reset($HTTP_GET_VARS); while (list($key, $val) = each($HTTP_GET_VARS)) { if (is_array($val)) { while (list($akey,$aval) = each($val)) { $HTTP_GET_VARS[$key][$akey] = strip_tags($aval); $$key[$akey] = strip_tags($aval); } } else { $HTTP_GET_VARS[$key] = strip_tags($val); $$key = strip_tags($val); } } } if(is_array($HTTP_COOKIE_VARS)) { reset($HTTP_COOKIE_VARS); while (list($key, $val) = each($HTTP_COOKIE_VARS)) { if (is_array($val)) { while (list($akey,$aval) = each($val)) { $HTTP_COOKIE_VARS[$key][$akey] = strip_tags($aval); $$key[$akey] = strip_tags($aval); } } else { $HTTP_COOKIE_VARS[$key] = strip_tags($val); $$key = strip_tags($val); } } }

« previous php.notes (#19551) next »