<?php if(isset($n) && isset($n) && isset($nu) && isset($st1)) { ob_start();//отправляем в буфер весь вывод $cooknam1=setcookie ("nameffa", $n,time()+25920000); $cooknam2=setcookie ("mailffa", $e,time()+25920000); $file="../comment/"; $file.=$nu; $file.=".php"; if(empty($n)||empty($st1)) { header ("location: $file"); exit; } $st1=safeHTML($st1); $file="../com1/"; $file.=$nu; $file.=".txt"; if($uk=fopen($file,"r")){ $st=fread($uk,filesize($file)); fclose($uk); } $t=explode("&{",$st); $s=sizeof($t); $t[0]+=1; $m=$t[0]; $st=implode("&{",$t); if($uk=fopen($file,"w")){ fwrite($uk,$st); fclose($uk); } $st=$n."&{".$e."&{".$m."&{"; $st.=$st1; $st.="&{"; if($uk=fopen($file,"a")){ fwrite($uk,$st); fclose($uk); } $file="../com2/"; $file.=$nu; $file.=".php"; header ("location: $file"); ob_end_flush() ;// освобождаем буфер } else header ("location: http://страница с формой, откуда пришел"); function safeHTML($text){ $text = strip_tags($text, '<b><i><u><a><img><br><center>'); $text = str_replace ("\n", "<br>", $text); return $text; } ?> |