I've found a function on web to sanitize user input data and used it for creating an alternative to $_POST[]
method as post()
. However, it seems that this function also sanitizes UTF-8 characters such as ç,ş,ö,ı,İ,Ö,ğ, converting them into strings like öl. I don't know which part of the code does that.
Thanks in advance.
Sanitizing function
function post($key) {
if (isset($_POST[$key])) {
$data = $_POST[$key];
if (is_array($data)) {
foreach ($data as $key => $element) {
$data[$key] = filter($element);
}
} else {
$data = trim(htmlentities(strip_tags($data)));
if(get_magic_quotes_gpc())
$data = stripslashes($data);
$data = pg_escape_string($data);
}
return $data;
} else {
return false;
}
}