note 99124 added to function.filter-input
| From: | ss23 at ss23 dot geek dot nz | Date: | Thu, 29 Jul 2010 06:37:52 +0000 |
| Subject: | note 99124 added to function.filter-input | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-171198@lists.php.net to get a copy of this message | ||
Note that this function doesn't (or at least doesn't seem to) actually filter based on the
current values of $_GET etc. Instead, it seems to filter based off the original values.
<?php
$_GET['search'] = 'foo'; // This has no effect on the filter_input
$search_html = filter_input(INPUT_GET, 'search', FILTER_SANITIZE_SPECIAL_CHARS);
$search_url = filter_input(INPUT_GET, 'search', FILTER_SANITIZE_ENCODED);
echo "You have searched for $search_html.\n";
echo "<a href='?search=$search_url'>Search again.</a>";
?>
If you need to set a default input value and filter that, use filter_var on your required input
variable instead
----
Server IP: 117.55.229.1
Probable Submitter: 59.167.236.95
----
Manual Page -- http://www.php.net/manual/en/function.filter-input.php
Edit -- https://master.php.net/note/edit/99124
Del: integrated -- https://master.php.net/note/delete/99124/integrated
Del: useless -- https://master.php.net/note/delete/99124/useless
Del: bad code -- https://master.php.net/note/delete/99124/bad+code
Del: spam -- https://master.php.net/note/delete/99124/spam
Del: non-english -- https://master.php.net/note/delete/99124/non-english
Del: in docs -- https://master.php.net/note/delete/99124/in+docs
Del: other reasons-- https://master.php.net/note/delete/99124
Reject -- https://master.php.net/note/reject/99124
Search -- https://master.php.net/manage/user-notes.php