Размер файла: 2.04Kb
<?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 />
Краткий текст:
<?php
$ms_pol = 'text1';
include($cms.'flud/js/bb.php');
include($cms.'flud/js/smyle.php');
include($cms.'flud/js/smyler.php');
include($cms.'flud/js/bber.php');?>
<textarea name="text1" rows=5 cols=20 style="width:100%;"></textarea>
Полный текст:<br />
<?php
srand();
$a = rand(1000,9000);
$ms_pol = 'mess1';
include($cms.'flud/js/bb.php');
include($cms.'flud/js/smyle.php');
include($cms.'flud/js/smyler.php');
include($cms.'flud/js/bber.php');?>
<textarea style="width:100%;" name="mess1" rows=10 cols=55></textarea><br />
<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'] != '' && $_POST['mess1'] != '' && $_POST['text1'] != '')
{
$news_file = date("d_m_Y_H_i_s");
while (is_file($cms.'news/base/pre_'.$news_file.'.txt'))
{
$news_file .= '1';
}
$fp = fopen ($cms.'news/base/pre_'.$news_file.'.txt', "w+");
fwrite ($fp, filt($_POST['text1']));
fclose ($fp);
$fp = fopen ($cms.'news/base/'.$news_file.'.txt', "w+");
fwrite ($fp, filt($_POST['mess1']));
fclose ($fp);
$fp = fopen ($cms.'news/base.txt', "a");
fwrite ($fp, $news_file.'|'.filt($_POST['name']).'|'.date("d/m/Y - H:i")."\r\n");
fclose ($fp);
echo '
<span class="ramka">
Сохранено.</span>
<META HTTP-EQUIV="Refresh" CONTENT="1;">
';
}
else
{
echo 'Одно или оба поля не заполнены! (Имя и текст)';
}
}
else
{
echo 'Одибка защитного кода.';
}
}
?>