Просмотр файла www/adm/forums/for_add_for.php

Размер файла: 2.55Kb
<?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 />
<?php
include($cms.'flud/js/bb.php');
include($cms.'flud/js/smyle.php');
$ms_pol = 'opis_f';
include($cms.'flud/js/smyler.php');
$ms_pol = 'opis_f';
include($cms.'flud/js/bber.php');?>
<textarea style="width: 100%;" name="opis_f" rows=10 cols=50></textarea>
<br />
Раздел:<br />
<?php
//выбор каталога
         echo '<select size="1" name="kat">
         ';
             $forum_r = @file($cms.'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($cms.'flud/anti_x.php');  //анти мат полный фильтр
        $o = $mess1;
        $n=strtr($n,array
        (
        "|"=>"I",
        "\r\n"=>"<br />",
        ));

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

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

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

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

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

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


         echo '
        <span class="ramka">
         Успешно!
        </span>
         <META HTTP-EQUIV="Refresh" CONTENT="1;">
        ';



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

 echo '</span>';
}
?>