Размер файла: 8.12Kb
<?
/*
=============================================
Движок: SHCMS Engine
=============================================
Название файла: Мини-чат
=============================================
Official website: http://shcms.ru
=============================================
Данный код защищен авторскими правами
=============================================
*/
define('SHCMS', true);
include_once'../system/inc/basic_settings.php';
$shcmsengine['title'] = 'Мини-Чат';
include_once'../template/head.php';
if($user_id)
{
if(isset($_GET['otv']))
{
if(isset($_GET['id']))
{
$mess_id = $_GET['id'];
}
$shoutsf = mysql_fetch_array(mysql_query("SELECT * FROM `shouts` WHERE `id` = '$mess_id'"));
$guest_sh = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '$shoutsf[user_id]'"));
$mess_ots = '[b]'.$guest_sh['login'].'[/b],';
}
$ban_user = mysql_fetch_array(mysql_query("SELECT * FROM `ban_shouts` WHERE `user_id` = '$user_id'"));
if($ban_user['ban_id'] == 2) {
errors('Вы забанены в Мини-чате <span class="mainforum"><a href="?act=ban">Подробнее..</a></span>');
}else {
echo '<div class="maintext">';
$form = new form ('?');
$form -> textarea ('<strong>Текст сообщения:</strong>','text',$mess_ots,true);
$form->captcha('captcha_guest');
$form -> submit ('Отправить','submit');
$form -> submit ('Обновить','refresh');
$form ->form_link(DIR_SHCMS.'smile.php','Смайлы');
$form->finish();
echo '</div>';
}
switch($act):
case'ban':
echo '<div class="mysql_no">';
$mysql_user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '$ban_user[id_admin]'"));
echo 'Забанил: <a href="'.DIR_SHCMS.'change_view.php?id='.$mysql_user['id'].'">'.$mysql_user['login'].'</a><br/>';
echo 'Начала бана: '.$timedate->times($ban_user['time']);
echo '<br/>Окончания бана: Как администратор решит!';
echo '</div>';
break;
endswitch;
}
if(isset($_POST['submit']))
{
$submit = $_POST['submit'];
}
if(isset($submit))
{
if(isset($_POST['login']))
{
$submit = $_POST['submit'];
}
if(isset($_POST['text']))
{
$text = $_POST['text'];
}
/*Отключения транслита
if($_POST['tran'] == 1)
{
$text = $translits->translit_rus($text);
}elseif($_POST['tran'] == 2)
{
$text = $translits->translit_eng($text);
}*/
if($settings_shcms['antilink'] == true) {
$text = $system_function->antilink($text);
}
if($settings_shcms['antimat'] == true) {
$text = $system_function->antimat($text);
}
if(empty($text))
{
echo '<div class="errors">Введите текст</div>';
header('Refresh: 1; url=?' . $conservation . '&' );
include_once'../template/foot.php';
exit;
}
if(strlen($text)< 0 or strlen($text) > 9200)
{
echo '<div class="errors">Ваш текст не должен превышать 9200символов</div>';
header('Refresh: 1; url=?' . $conservation . '&' );
include_once'../template/foot.php';
exit;
}
if($settings_shcms['captcha_guest'] == 1)
{
$antibot = isset($_POST['kod']) ? trim($_POST['kod']) : '';
if (empty($antibot) || strlen($antibot) < 3)
{
echo '<div class="errors">Код безопастности не введен!</div>';
header('Refresh: 1; url=?' . $conservation . '&' );
include_once'../template/foot.php';
exit;
}
elseif ($antibot != $_SESSION['code'])
{
echo '<div class="errors">Код безопасности не соответствует отображённому</div>';
header('Refresh: 1; url=?' . $conservation . '&' );
include_once'../template/foot.php';
exit;
}
unset($_SESSION['code']);
}
$text = stripslashes($text);
$text = htmlspecialchars($text);
$yel = mysql_query("INSERT INTO `shouts` (text,time,user_id) VALUES ('".my_esc($text)."','".time()."','$user_id')");
$balls = $users_nav['ball'] +1;
mysql_query("UPDATE `users` SET `ball`='$balls' WHERE `id`='$user_id'");
if($yel == true)
{
messag ('Сообщение успешно добавлено');
header('Refresh: 1; url=?'.$conservation.'&' );
include_once'../template/foot.php';
exit;
}
else
{
echo '<div class="errors">Сообщение не добавлено</div>';
header('Refresh: 1; url=?' . $conservation . '&' );
include_once'../template/foot.php';
exit;
}
}
$allfield = mysql_result(mysql_query("SELECT COUNT(*) FROM `shouts`"),0);
$newlist = new Navigation($allfield, 10, true);
$shouts = mysql_query("SELECT * FROM `shouts` ORDER BY `id` DESC ". $newlist->limit()." ");
$shouts2 = mysql_fetch_array($shouts);
$count_user = mysql_result(mysql_query("SELECT COUNT(*) FROM `shouts` WHERE `user_id` = '$user_id'"),0);
echo '<div class="maintext"><img src="/template/icon/pisem.gif"/> Всего сообщений в мини чате: <b>'.$allfield.'</b>, из них ваши <b>'.$count_user.'</b></div>';
if($shouts2 == null)
{
echo '<div class="maintext"><img src="../template/icon/empty.png"> Сообщений в мини-чате нет!</div>';
}
else
{
do
{
$list_ban = mysql_fetch_array(mysql_query("SELECT * FROM `ban_shouts`"));
$ban_ls = mysql_fetch_array(mysql_query("SELECT * FROM `ban_shouts` WHERE `user_id` = '$shouts2[user_id]'"));
echo '<div class="maintitle">';
users_profile($shouts2['user_id']);
list_users($shouts2['user_id']);
echo' <span class="maintime">'.$timedate->times($shouts2['time']).'</span>';
echo '</div>';
echo "<div class='maintext'>".processing($shouts2['text'])."";
if($users_user['team'] == 6) {
echo '<div style="text-align:right">';
if($ban_ls['user_id'] == $shouts2[user_id]) {
echo '<a href="ban_users.php?act=delete&id='.$shouts2['user_id'].'">
<img title="Снять бан" src="../template/icon/open.png"/></a>'; }else {
echo '<a href="ban_users.php?act=insert&id='.$shouts2['user_id'].'">
<img title="Забанить" src="../template/icon/users/ban.png"/></a>';
}
echo '<a href="?otv&id='.$shouts2['id'].'">
<img title="Ответить" src="../template/icon/replayal.png"/></a>  
<a href="delete.php?id='.$shouts2['id'].'">
<img title="Удалить" src="../template/icon/delete.png"/></a></div>';
}
else{
if($user_id)
{
echo '<div style="text-align:right"><a href="?otv&id='.$shouts2['id'].'"><img title="Ответить" src="../template/icon/replayal.png"/></a></div>';
}
}
echo '</div>';
}
while($shouts2 = mysql_fetch_array($shouts));
echo '<div class="pages">';
echo $newlist->pagination();
echo '</div>';
}
if(isset($_POST['refresh']))
{
$refresh = $_POST['refresh'];
}
if(isset($refresh))
{
header('Refresh: 1; url=?'.$conservation.'&');
}
if($user4['team'] == 6)
{
echo '<div class="posts"><a href="remove_all.php">Очистка мини-чата</a></div>';
}
include_once'../template/foot.php';
?>