When searching in Google for my site I saw a warning "This site may be hacked". And indeed my site was been hacked. A lot of new files were created in an existing folder ("mail"). Only one existing index file was altered (with links these new files). I only have 1 dynamic page using below code to sanitize. Is this code OK? It is on a Windows server.
function Clean($varia) {
$varia=rtrim($varia);
$varia=ltrim($varia);
$varia=htmlentities($varia, ENT_QUOTES);
$varia=str_replace("\n","<br>",$varia);
if (get_magic_quotes_gpc()) {$varia = stripslashes($varia);}
return $varia;}
foreach($_POST as $name1 => $value){$_POST[$name1] = Clean($value);}
foreach($_GET as $name1 => $value){$_GET[$name1] = Clean($value);}