Sanitize a single input value and removes line breaks, tabs and null characters.
public static sanitizeInputValue ( string $value ) : string | ||
$value | string | |
return | string | sanitized input |
$input = $_POST['username']; $sanitized_input = Piwik\Common::sanitizeInputValue($input); $query = "SELECT * FROM users WHERE username = '$sanitized_input'";
$input = $_GET['search']; $sanitized_input = Piwik\Common::sanitizeInputValue($input); echo "You searched for: " . $sanitized_input;In both examples, the input value is sanitized using the Piwik Common library's sanitizeInputValue function, which ensures that any potential harmful characters are removed or escaped. This helps prevent malicious attacks on the website or application. Piwik is a free and open-source web analytics platform that provides detailed reports on website traffic and visitor behavior. The Common library is a part of the Piwik PHP library that contains various utility functions commonly used in web development, such as sanitizing input values, formatting dates, and generating random numbers.
public static sanitizeInputValue ( string $value ) : string | ||
$value | string | |
return | string | sanitized input |