Просмотр файла news/com_add.php

Размер файла: 1.35Kb
<?php
  $ms_max = 500;                        // максимальный размер поля
?>
<form class="ramka" action="" method="post">
<?php
if ($_SESSION['user_login'] != '')
  echo ('<div align="right">'.$_SESSION['user_login'].':</div>');
  else
  echo 'IP: '.$_SESSION['login'];
?>
<textarea onkeyup="Change()" onkeydown="SendComment(event)" style="width: 99%;" name="fa_mess1" rows=2 cols=20></textarea><br />
<input name="pokas" type="hidden" value="file_com_add">
<input class="knopka" type="submit" value="Cохранить">
</form>
<br>
<?php
if (empty($_SESSION['comm_news'])) $_SESSION['comm_news'] = 'test_in_news';
 if (trim($_POST['fa_mess1']) != '')
 {
  if ($_SESSION['comm_news'] != trim($_POST['fa_mess1']))
  {
  $_SESSION['comm_news'] = trim($_POST['fa_mess1']);

  $mess1 = substr($_POST['fa_mess1'],0,$ms_max);
  include($cms.'flud/anti_x.php');
  $text = $mess1;

  if ($_SESSION['user_login'] != '')
  $name_quest = ('[b]'.$_SESSION['user_login'].' сказал:[/b]');
  else
  $name_quest = ('[b]Гость с IP: '.$_SESSION['login'].'[/b]');

  $mess1 = $name_quest;
  include($cms.'flud/anti_x.php');
  $name_quest = $mess1;

  $fp = fopen ($cms.'news/coment/'.trim($fn[3]).'.txt', "a+");
  fwrite ($fp, date("d/m/Y").'|'.$name_quest.'|'.stripslashes($text)."\r\n");
  fclose ($fp);
  }
 }
?>
 <hr>