note 4752 deleted from strip_tags by ronabop
| From: | ronabop@php.net | Date: | Mon, 02 Oct 2000 11:27:20 +0000 |
| Subject: | note 4752 deleted from strip_tags by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-5932@lists.php.net to get a copy of this message | ||
Generic PHP code to make any PHP script safe against cross system scripting attacks:
<PRE>
if(is_array($HTTP_POST_VARS)) {
reset($HTTP_POST_VARS);
while (list($key, $val) = each($HTTP_POST_VARS)) {
$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)) {
$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)) {
$HTTP_COOKIE_VARS[$key] = strip_tags($val);
$$key = strip_tags($val);
}
}
</PRE>