View file modile/adm/for_add_for.php

File size: 2.47Kb
<?php
Defined('ADMIN_S_S') or die ('Доступ запрещен!!!');
echo
'<span class="ramka">
Добавить форум.
</span><br>';
if ($_POST['pokas'] != 3)
{


?>
<span class="ramka">
<form name="" action="" enctype="multipart/form-data" method="post">
Заголовок:<br>
<input name="im_f" type="text" value=""><br>
Описание:<br>
<textarea style="width: 100%;" name="opis_f" rows=10 cols=50></textarea>
<br>
Раздел:<br>
<?php
//выбор каталога
         echo '<select size="1" name="kat">
         ';
             $forum_r = @file('forum/base/catalog.txt');
             $forum_c = count($fprum_r);
             $forum_cc = 0;
			 while ($forum_r[$forum_cc] != '')
			 {
			  $exe = explode('|',$forum_r[$forum_cc]);
			  echo '<option value="'.trim($exe[1]).'">'.$exe[0].'</option>';
			  echo '<br><br>';
			  $forum_cc++;
			 }

          echo '</select><br />
          ';

//выбор каталога
?>
<input name="pokas" type="hidden" value="3">
<input type="submit" value="Добавить">
</form>
</span>
<?php }
else
{
 echo '<span class="ramka">';
 if ($_POST['im_f'] != "" and $_POST['opis_f'] != "")
 {




        $n = htmlspecialchars (substr($_POST['im_f'],0,50));
        $save_n = substr(md5($n),0,10);
        $o = substr($_POST['opis_f'],0,1000);
        $mess1 = $o;
        include('flud/anti_x.php');  //анти мат полный фильтр
        $o = $mess1;
        $n=strtr($n,array
        (
        "|"=>"I",
        "\r\n"=>"<br>",
        ));

        if (is_file('forum/'.$save_n.'/namekat.txt'))
        $save_n = $save_n.'copy';

        mkdir('forum/'.$save_n.'',0777);

        $fp = fopen ('forum/'.$save_n.'/namekat.txt', "w+");
        fwrite ($fp, stripslashes($n));
        fclose ($fp);

        $fp = fopen ('forum/'.$save_n.'/nametem.txt', "w+");
        fclose ($fp);

        $fp = fopen ('forum/'.$save_n.'/opiskat.txt', "w+");
        fwrite ($fp, stripslashes($mess1));
        fclose ($fp);

        $fp = fopen ('forum/base/'.trim($_POST['kat']).'.txt', "a+");
        fwrite ($fp, $save_n."\r\n");
        fclose ($fp);


         echo '
        <span class="ramka">
         Успешно!
        </span>
         <a href="/adminf.php?m='.$_GET['m'].'&id='.$_GET['id'].'">Далее</a>
        ';



 }
 else
 {
  echo 'Ошибка. Не заполнено имя и/или описание.';
 }

 echo '</span>';
}
?>