Функция экранирования основных знаков
function check($msg){
if (is_array($msg)) {
foreach($msg as $key=>$val) {
$msg[$key] = check($val);
}
} else {
$msg = htmlspecialchars($msg);
$search = array('|','\'','$','\\','^','%','`',"\0");
$replace = array('|',''','$','\','^','%','`','');
$msg = str_replace($search, $replace, $msg);
$msg = stripslashes(trim($msg));
}
return $msg;
}
Функция удаления основных знаков
function check_full($message){
$message=str_replace("|","I",$message);
$message=str_replace("||","I",$message);
$message=str_replace("&","",$message);
$message=str_replace("\"","",$message);
$message=str_replace(">","",$message);
$message=str_replace("<","",$message);
$message=htmlspecialchars($message);
$message=str_replace("'","",$message);
$message=str_replace("\"","",$message);
$message=str_replace("\$","",$message);
$message=str_replace("$","",$message);
$message=str_replace("\\","", $message);
$message=str_replace("`","", $message);
$message=str_replace("%","", $message);
$message=stripslashes(trim($message));
return $message;
}