note 72664 added to function.htmlentities
| From: | wildcats1369 at osu1 dot php dot net | Date: | Mon, 29 Jan 2007 09:41:04 +0000 |
| Subject: | note 72664 added to function.htmlentities | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-122309@lists.php.net to get a copy of this message | ||
This procedure will change POST and GET variables how deep they might be to prevent Code Insertion.
I hope it becomes useful.
<?
if(isset($_POST))
{
$_POST=strip_array($_POST);
}
if(isset($_GET))
{
$_GET=strip_array($_GET);
}
function strip_array($array) //recursively
{
foreach($array as $key=>$value)
{
if(is_array($value))
{
$ret[$key]=strip_array($value);
}else
{
$ret[$key]=addslashes(htmlspecialchars($value,ENT_QUOTES));
}
}
return $ret;
}
?>
----
Server IP: 203.202.10.60
Probable Submitter: 124.104.75.43
----
Manual Page -- http://www.php.net/manual/en/function.htmlentities.php
Edit -- https://master.php.net/note/edit/72664
Del: integrated -- https://master.php.net/note/delete/72664/integrated
Del: useless -- https://master.php.net/note/delete/72664/useless
Del: bad code -- https://master.php.net/note/delete/72664/bad+code
Del: spam -- https://master.php.net/note/delete/72664/spam
Del: non-english -- https://master.php.net/note/delete/72664/non-english
Del: in docs -- https://master.php.net/note/delete/72664/in+docs
Del: other reasons-- https://master.php.net/note/delete/72664
Reject -- https://master.php.net/note/reject/72664
Search -- https://master.php.net/manage/user-notes.php