Просмотр файла add.php

Размер файла: 3.37Kb
<?
#-----------------------------------------------#
#             	Аuthor:  Nu3oN                  #
#                  ICQ : 100-50-97              #
#-----------------------------------------------#
require_once ('../includes/start.php');
require_once ('../includes/functions.php');
require_once ('../includes/header.php');
include_once ('../themes/'.$config['themes'].'/index.php');
require_once ('distribution/swapping.php');
show_title('partners.gif', ' Анекдоты / Добавление анекдота');


if (is_file($Dir_db.'/jokes/'.$nCat.'.dat'))
{

if (is_file($Dir_db.'/names/'.$nCat.'.dat'))
{
$_exp = explode(':||:', file_get_contents($Dir_db.'/names/'.$nCat.'.dat'));
$nameCat = $_exp['0'];
}
else
{
$nameCat = $nCat;
}



if (is_user())
{


if (isset($_POST['submit_new_joke']) and $_POST['submit_new_joke'])
{
if (isset($_POST['text_joke']) and iconv_strlen($_POST['text_joke'],'UTF-8') > 5 and iconv_strlen($_POST['text_joke'],'UTF-8') < 1000):
antiflood("Location: index.php?isset=antiflood&".SID);
karantin($udata[6], "Location: index.php?isset=karantin&".SID);

$_textJoke = smiles(antimat(no_br(check($_POST['text_joke']), '<br />')));
$_textJoke = no_br($_textJoke.':||:'.$log.':||:'.SITETIME.':||:'.$brow.':||:'.$ip.':||:');
$_addJoke_r = write_files($Dir_db.'/jokes/'.$nCat.'.dat', $_textJoke."\r\n");

if (!trim($_addJoke_r))
{

change_profil($log, array(14 => $ip, 36 => $udata['36']+1, 41 => $udata['41']+1));

$_refTot = explode(':||:',file_get_contents($Dir_db.'/names/'.$nCat.'.dat'));
$_refTot = $_refTot['0'].':||:'.(trim($_refTot['1']) ? ($_refTot['1']+1) : 1).':||:';
replace_lines($Dir_db.'/names/'.$nCat.'.dat', 0, $_refTot);

header('Refresh: 1; url=index.php?cat='.$nCat.'&'.SID);
echo '<div class="isset"> Анекдот успешно добавлен </div><br />
<img src="../images/img/back.gif" alt=""> <a href="index.php?cat='.$nCat.'&amp;'.SID.'">'.$nameCat.'</a><br />
<img src="../images/img/back.gif" alt=""> <a href="index.php?'.SID.'">Вернуться</a> <br />
<img src="../images/img/homepage.gif" alt=""> <a href="../index.php?'.SID.'">На главную</a>';
include_once ('../themes/'.$config['themes'].'/foot.php'); die;

}
else
{
show_error('Ошибка записи анекдота<br />');
}
else: show_error('Ошибка! Слишком длинное или короткое сообщение!<br />'); endif;
}




echo '<form action="add.php?cat='.$nCat.'&amp;'.SID.'" method="post">
<div class="b">Категрия: <b> '.$nameCat.' </b><br />
<textarea cols="55" rows="5" name="text_joke"></textarea><br />
<input name="submit_new_joke" type="submit" value=" Добавить анекдот " />
</div></form>';


}
else
{
show_error('Вы не авторизованы, чтобы добавить анекдот, необходимо авторизоваться');
}

echo '<br /><img src="../images/img/back.gif" alt=""> <a href="index.php?cat='.$nCat.'&amp;'.SID.'">'.$nameCat.'</a>';

}
else
{
show_error('Выбранной категории не существует');
}



echo '<br /><img src="../images/img/back.gif" alt=""> <a href="index.php?'.SID.'">Вернуться</a> <br />
<img src="../images/img/homepage.gif" alt=""> <a href="../index.php?'.SID.'">На главную</a>';


include_once ('../themes/'.$config['themes'].'/foot.php'); 
?>