<?php @setlocale(LC_ALL, array ('ru_RU.CP1251', 'rus_RUS.1251')); $filtr = "#^(.*)+\.(ru|com|net|gg|h15|h18|de|ua|su|org|net|edu)#i"; if(!empty($_POST['txt'])){ $text = trim(htmlspecialchars(strtolower($_POST['txt']))); $text = preg_replace($filtr, '[Censored]', $text); $text = '<font size="'.mt_rand(1,8).'">'.$text.'</font>'; $f = fopen("text.txt","at"); flock($f,2); fwrite($f," ".$text); flock($f,3); fclose($f); header("Location: ".$_SERVER['SCRIPT_NAME']); exit(); } echo file_get_contents("text.txt"); echo ("<form action='".$_SERVER['SCRIPT_NAME']."' method='POST'> <input type='text' name='txt' size = '30' maxlength='30'> <input type='submit' value='Добавить!'> </form>"); ?>