note 88850 added to function.eregi
| From: | julia_kean25 at yahoo dot com | Date: | Tue, 10 Feb 2009 22:15:30 +0000 |
| Subject: | note 88850 added to function.eregi | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-150463@lists.php.net to get a copy of this message | ||
I use this in my app_config.php file to sanitize each request:
<?php
// app_config.php
/**
* SANITIZE REQUEST
*/
function sanitize_request($methods, $array)
{
// methods: trim ; addslashes ; stripslashes ; etc...
// array : $_GET ; $_POST ; etc...
foreach ($methods as $function) {
$array = array_map($function, $array);
}
return $array;
}
if ( ! get_magic_quotes_gpc() )
{
$methods = array('trim', 'addslashes');
$_GET = sanitize_request($methods, $_GET);
$_POST = sanitize_request($methods, $_POST);
$_COOKIE = sanitize_request($methods, $_COOKIE);
$_REQUEST = sanitize_request($methods, $_REQUEST);
}
?>
it currently only trims and adds slashes to the request but it would be nice to have the possibility
to add the striptags function too.
----
Server IP: 69.147.83.197
Probable Submitter: 89.137.175.191
----
Manual Page -- http://www.php.net/manual/en/function.eregi.php
Edit -- https://master.php.net/note/edit/88850
Del: integrated -- https://master.php.net/note/delete/88850/integrated
Del: useless -- https://master.php.net/note/delete/88850/useless
Del: bad code -- https://master.php.net/note/delete/88850/bad+code
Del: spam -- https://master.php.net/note/delete/88850/spam
Del: non-english -- https://master.php.net/note/delete/88850/non-english
Del: in docs -- https://master.php.net/note/delete/88850/in+docs
Del: other reasons-- https://master.php.net/note/delete/88850
Reject -- https://master.php.net/note/reject/88850
Search -- https://master.php.net/manage/user-notes.php