[eluser]Tominator[/eluser]
Hello,
you can make function like this:
Code:
function MakeMeSave(&$input) {
if(is_array($input)) {
array_walk_recursive($input,"SaveValue");
} else {
safetyValue($input);
}
}
function SaveValue(&$value) {
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
$value = htmlspecialchars($value);
$value = str_replace("'", "'", $value);
$value = str_replace("\\", "\\\\", $value);
$value = str_replace("%", "%", $value);
$value = trim($value);
}
And then in your code you can call just:
It will work correctly in PHP5. If would you like to make max-lenght limit, you can just add line.