View file adm/add_stat.php

File size: 1.46Kb
<?php
Defined('ADMIN_S_S') or die ('Доступ запрещен!!!');
echo
'<span class="ramka">
Добавить статью.
</span><br>';
if ($_POST['pokas'] != 2)
{  ?>
<span class="ramka">
<form name="" action="" method="post">
Заголовок:<br>
<input name="name" type="text" value=""><br />
Текст:<br>
<?php
include('flud/js/bb.php');
include('flud/js/smyle.php');
$ms_pol = 'mess1';
include('flud/js/smyler.php');
$ms_pol = 'mess1';
include('flud/js/bber.php');?>

<textarea style="width:100%;" name="mess1" rows=10 cols=55></textarea><br />
<?php
srand();
$a = rand(1000,9000);


?>
<input name="capt" type="hidden" value="<?php echo $a;?>">
<input name="capt2" type="hidden" value="<?php echo $a;?>"><br>
<br><input class="knopka" type="submit" value="Послать">
<input name="pokas" type="hidden" value="2">
</form>
</span>
<?php	}
else
{
 if (htmlspecialchars(trim($_POST['capt'])) == htmlspecialchars(trim($_POST['capt2'])))
 {
  if ($_POST['name'] != '' and $_POST['mess1'] != '')
  {
   $mess1 = $_POST['mess1'];
   include('flud/anti_x.php');
   $name = $_POST['name'];
   $fp = fopen ('stat/base.txt', "a+");
   fwrite ($fp, stripslashes($name).'|'.stripslashes($mess1).'|'.date("d/m/Y")."\r\n");
   fclose ($fp);

   echo '
   <span class="ramka">
   Сохранено.</span>
   <META HTTP-EQUIV="Refresh" CONTENT="1;">
   ';
  }
  else
  {
   echo 'Одно или оба поля не заполнены! (Имя и текст)';
  }
 }
 else
 {
  echo 'Одибка защитного кода.';
 }
}
?>