$file=file("$datadir/$datafile");
$fp=fopen("$datadir/$datafile","w");
flock ($fp,LOCK_EX);
ftruncate ($fp,0);
for ($ii=0;$ii< sizeof($file);$ii++)
{ if ($fnomer!=$ii) {fputs($fp,$file[$ii]);} else {fputs($fp,"$mtext\r\n");} }
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);