function proverka ($x)
{
$x=wordwrap($x,35,' ',1);
$x=str_replace(" ",' ',$x);
$x=str_replace("&",'&',$x);
$x=str_replace(">",'>',$x);
$x=str_replace("<",'<',$x);
$x=str_replace("\"",'"',$x);
$x=preg_replace("/\n\n/",'<p>',$x);
$x=preg_replace("/\n/",'<br>',$x);
$x=preg_replace("/\\\$/",'$',$x);
$x=preg_replace("/\r/",'',$x);
$x=stripslashes($x);
$x=preg_replace("/\\\/",'\',$x);
$x=str_replace("\r\n","<br> ",$x);
$x=str_replace("\n\n",'<p>',$x);
$x=str_replace("\n",'<br> ',$x);
do {$x=str_replace("<br><br><br>","<br>",$x);} while (preg_match("/<br><br><br><br>/i",$x)); Вырезаем 3 и более ентеров
do {$x=str_replace(" "," ",$x);} while (preg_match("/ /i",$x));// Вырезаем 3 и более пробелов подряд
$x=str_replace("\t",' ',$x);
$x=str_replace("\r",' ',$x);
$x=str_replace(' ',' ',$x);
return $x;
}
$add_name=proverka($_POST['name']);
|