|
|
|
@ -75,8 +75,8 @@ mixed *filter_data* (mixed *variable*, int *filter* [, mixed *filter_options*, [ |
|
|
|
* INPUT_GET 1 |
|
|
|
* INPUT_COOKIE 2 |
|
|
|
* INPUT_ENV 4 |
|
|
|
* INPUT_SERVER 5 |
|
|
|
* INPUT_SESSION 6 |
|
|
|
* INPUT_SERVER 5 (not implemented yet) |
|
|
|
* INPUT_SESSION 6 (not implemented yet) |
|
|
|
|
|
|
|
|
|
|
|
Logical Filters |
|
|
|
@ -86,10 +86,12 @@ These filters check whether passed data was valid, and do never mangle input |
|
|
|
variables, but ofcourse they can deny the whole input variable getting to the |
|
|
|
application by returning false. |
|
|
|
|
|
|
|
The constants should be prepended by `FILTER_VALIDATE_` when used with php. |
|
|
|
|
|
|
|
================ ========== =========== ================================================== |
|
|
|
Name Constant Return Type Description |
|
|
|
================ ========== =========== ================================================== |
|
|
|
int FL_INT integer Returns the input variable as an integer |
|
|
|
int INT integer Returns the input variable as an integer |
|
|
|
|
|
|
|
$filter_options - an array with the optional |
|
|
|
elements: |
|
|
|
@ -105,19 +107,19 @@ int FL_INT integer Returns the input variable as an integer |
|
|
|
- ALLOW_HEX: allow hexadecimal numbers with the |
|
|
|
format 0xnn or 0Xnn too. |
|
|
|
|
|
|
|
boolean FL_BOOLEAN boolean Returns *true* for '1', 'on' and 'true' and *false* |
|
|
|
boolean BOOLEAN boolean Returns *true* for '1', 'on' and 'true' and *false* |
|
|
|
for '0', 'off' and 'false' |
|
|
|
|
|
|
|
float FL_FLOAT float Returns the input variable as a floating point value |
|
|
|
float FLOAT float Returns the input variable as a floating point value |
|
|
|
|
|
|
|
validate_regexp FL_REGEXP string Matches the input value as a string against the |
|
|
|
validate_regexp REGEXP string Matches the input value as a string against the |
|
|
|
regular expression. If there is a match then the |
|
|
|
string is returned, otherwise the filter returns |
|
|
|
*null*. |
|
|
|
Remarks: Only available if pcre has been compiled |
|
|
|
into PHP. |
|
|
|
|
|
|
|
validate_url FL_URL string Validates an URL's format. |
|
|
|
validate_url URL string Validates an URL's format. |
|
|
|
|
|
|
|
$filter_options - an bitmask that supports the |
|
|
|
following flags: |
|
|
|
@ -131,11 +133,11 @@ validate_url FL_URL string Validates an URL's format. |
|
|
|
* QUERY_REQUIRED: The 'query' part of the URL |
|
|
|
needs to in the passed URL. |
|
|
|
|
|
|
|
validate_email FL_EMAIL string Validates the passed string against a reasonably |
|
|
|
validate_email EMAIL string Validates the passed string against a reasonably |
|
|
|
good regular expression for validating an email |
|
|
|
address. |
|
|
|
|
|
|
|
validate_ip FL_IP string Validates a string representing an IP address. |
|
|
|
validate_ip IP string Validates a string representing an IP address. |
|
|
|
|
|
|
|
$filter_options - an bitmask that supports the |
|
|
|
following flags: |
|
|
|
@ -155,11 +157,13 @@ Sanitizing Filters |
|
|
|
These filters remove data, or change data depending on the filter, and the |
|
|
|
set rules for this specific filter. Instead of taking an *options* array, they |
|
|
|
use this parameter for flags for the specific filter. |
|
|
|
|
|
|
|
|
|
|
|
The constants should be prepended by `FILTER_SANITIZE_` when used with php. |
|
|
|
|
|
|
|
============= ================ =========== ===================================================== |
|
|
|
Name Constant Return Type Description |
|
|
|
============= ================ =========== ===================================================== |
|
|
|
string FS_STRING string Returns the input variable as a string after it has |
|
|
|
string STRING string Returns the input variable as a string after it has |
|
|
|
been stripped of XML/HTML tags and other evil things |
|
|
|
that can cause XSS problems. |
|
|
|
|
|
|
|
@ -184,9 +188,9 @@ string FS_STRING string Returns the input variable as a strin |
|
|
|
the case they clash, the characters will be |
|
|
|
stripped. |
|
|
|
|
|
|
|
stripped FS_STRIPPED string Alias for 'string'. |
|
|
|
stripped STRIPPED string Alias for 'string'. |
|
|
|
|
|
|
|
encoded FS_ENCODED string Encodes all characters outside the range |
|
|
|
encoded ENCODED string Encodes all characters outside the range |
|
|
|
"a-zA-Z0-9-._" as URL encoded values. |
|
|
|
|
|
|
|
$filter_options - an bitmask that supports the |
|
|
|
@ -201,7 +205,7 @@ encoded FS_ENCODED string Encodes all characters outside the ra |
|
|
|
* ENCODE_HIGH: allows characters >= 0x80 but encodes |
|
|
|
them as numerical HTML entities |
|
|
|
|
|
|
|
special_chars FS_SPECIAL_CHARS string Encodes the 'special' characters ' " < > &, \0 and |
|
|
|
special_chars SPECIAL_CHARS string Encodes the 'special' characters ' " < > &, \0 and |
|
|
|
everything below 0x20 as numerical HTML entities. |
|
|
|
|
|
|
|
$filter_options - an bitmask that supports the |
|
|
|
@ -216,7 +220,7 @@ special_chars FS_SPECIAL_CHARS string Encodes the 'special' characters ' " |
|
|
|
* ENCODE_HIGH: allows characters >= 0x80 but encodes |
|
|
|
them as numerical HTML entities |
|
|
|
|
|
|
|
unsafe_raw FS_UNSAFE_RAW string Returns the input variable as a string without |
|
|
|
unsafe_raw UNSAFE_RAW string Returns the input variable as a string without |
|
|
|
XML/HTML being stripped from the input value. |
|
|
|
|
|
|
|
$filter_options - an bitmask that supports the |
|
|
|
@ -237,7 +241,7 @@ unsafe_raw FS_UNSAFE_RAW string Returns the input variable as a strin |
|
|
|
the case they clash, the characters will be |
|
|
|
stripped. |
|
|
|
|
|
|
|
email FS_EMAIL string Removes all characters that can not be part of a |
|
|
|
email EMAIL string Removes all characters that can not be part of a |
|
|
|
correctly formed e-mail address (exception are |
|
|
|
comments in the email address) (a-z A-Z 0-9 " ! # $ |
|
|
|
% & ' * + - / = ? ^ _ ` { | } ~ @ . [ ]). This |
|
|
|
@ -245,15 +249,15 @@ email FS_EMAIL string Removes all characters that can not b |
|
|
|
the correct format, use the validate_email filter |
|
|
|
for that. |
|
|
|
|
|
|
|
url FS_URL string Removes all characters that can not be part of a |
|
|
|
url URL string Removes all characters that can not be part of a |
|
|
|
correctly formed URI. (a-z A-Z 0-9 $ - _ . + ! * ' ( |
|
|
|
) , { } | \ ^ ~ [ ] ` < > # % " ; / ? : @ & =) This |
|
|
|
filter does `not` validate if a URI has the correct |
|
|
|
format, use the validate_url filter for that. |
|
|
|
|
|
|
|
number_int FS_NUMBER_INT int Removes all characters that are [^0-9+-]. |
|
|
|
number_int NUMBER_INT int Removes all characters that are [^0-9+-]. |
|
|
|
|
|
|
|
number_float FS_NUMBER_FLOAT float Removes all characters that are [^0-9+-]. |
|
|
|
number_float NUMBER_FLOAT float Removes all characters that are [^0-9+-]. |
|
|
|
|
|
|
|
$filter_options - an bitmask that supports the |
|
|
|
following flags: |
|
|
|
@ -265,7 +269,7 @@ number_float FS_NUMBER_FLOAT float Removes all characters that are [^0-9 |
|
|
|
* ALLOW_SCIENTIFIC: adds "eE" to the characters that |
|
|
|
are not stripped. |
|
|
|
|
|
|
|
magic_quotes FS_MAGIC_QUOTES string BC filter for people who like magic quotes. |
|
|
|
magic_quotes MAGIC_QUOTES string BC filter for people who like magic quotes. |
|
|
|
============= ================ =========== ===================================================== |
|
|
|
|
|
|
|
|
|
|
|
@ -279,11 +283,13 @@ supported: |
|
|
|
* function with *'functionname'* |
|
|
|
* static method with *array('classname', 'methodname')* |
|
|
|
* dynamic method with *array(&$this, 'methodname')* |
|
|
|
|
|
|
|
|
|
|
|
The constants should be prepended by `FILTER_` when used with php. |
|
|
|
|
|
|
|
============= =========== =========== ===================================================== |
|
|
|
Name Constant Return Type Description |
|
|
|
============= =========== =========== ===================================================== |
|
|
|
callback FC_CALLBACK mixed Calls the callback function/method with the input |
|
|
|
callback CALLBACK mixed Calls the callback function/method with the input |
|
|
|
variable's value by reference which can do filtering |
|
|
|
and modifying of the input value. If the callback |
|
|
|
function returns "false" then the input value is |
|
|
|
|