Файл: test.masteram.us/tachik/index.php
Строк: 87
<?
include '../Core.php';
user_access('adm_panel_show',null,'/index.php?'.SID);
$set['title']='Админ-чат'; // заголовок страницы
include_once '../sys/inc/thead.php';
title();
if (isset($user) && $user['level']>2)include 'inc/admin_act.php';
if (isset($_POST['msg']) && isset($user))
{
$msg=$_POST['msg'];
if (isset($_POST['translit']) && $_POST['translit']==1)$msg=translit($msg);
if (strlen2($msg)>1024){$err='Сообщение слишком длинное';}
elseif (strlen2($msg)<2){$err='Короткое сообщение';}
elseif (mysql_result(mysql_query("SELECT COUNT(*) FROM `adm_chat` WHERE `id_user` = '$user[id]' AND `msg` = '".mysql_escape_string($msg)."' LIMIT 1"),0)!=0){$err='Ваше сообщение повторяет предыдущее';}
else{
$msg=mysql_escape_string($msg);
mysql_query("INSERT INTO `adm_chat` (id_user, time, msg) values('$user[id]', '$time', '$msg')");
mysql_query("UPDATE `user` SET `balls` = '".($user['balls']+1)."' WHERE `id` = '$user[id]' LIMIT 1");
msg('Сообщение успешно добавлено');
}
}
err();
echo '<div class="textmes">';
echo "<a href='/smiles/index.php'><font color='black'>Смайлы</font></a> | n";
echo "<a href='/tachik/'><font color='black'>Обновить</font></a> n";
if (isset($user))
{
echo "<form method="post" action="?">n";
echo "<textarea name="msg"></textarea><br />n";
if ($user['set_translit']==1)echo "<label><input type="checkbox" name="translit" value="1" /> Транслит</label><br />n";
echo "<input value="Отправить" type="submit" />n";
echo "</form>n";
}
echo '</div>';
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `adm_chat`"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
echo "<table class='post'>n";
if ($k_post==0)
{
echo " <tr>n";
echo " <td class='p_t'>n";
echo "Нет сообщенийn";
echo " </td>n";
echo " </tr>n";
}
$q=mysql_query("SELECT * FROM `adm_chat` ORDER BY id DESC LIMIT $start, $set[p_str]");
while ($post = mysql_fetch_array($q))
{
$ank=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = $post[id_user] LIMIT 1"));
echo " <tr>n";
if ($set['set_show_icon']==2){
echo " <td class='icon48' rowspan='2'>n";
avatar($ank['id']);
echo " </td>n";
}
elseif ($set['set_show_icon']==1)
{
echo " <td class='icon14'>n";
echo "<img src='/style/themes/$set[set_them]/user/$ank[pol].png' alt='' />";
echo " </td>n";
}
echo " <td class='admchat'>n";
echo "<a href='/info.php?id=$ank[id]'>$ank[nick]</a>".online($ank['id'])." (".vremja($post['time']).")n";
echo " </td>n";
echo " </tr>n";
echo " <tr>n";
if ($set['set_show_icon']==1)echo " <td class='gmenu' colspan='2'>n"; else echo " <td class='p_m'>n";
echo esc(trim(br(bbcode(smiles(links(stripcslashes(htmlspecialchars($post['msg']))))))))."<br />n";
if (isset($user) && ($user['level']>$ank['level'] || $user['level']==4))
echo "<a href='delete.php?id=$post[id]'>Удалить</a><br />n";
echo " </td>n";
echo " </tr>n";
}
echo "</table>n";
if ($k_page>1)str('?',$k_page,$page); // Вывод страниц
if (isset($user) && $user['level']>2)include 'inc/admin_form.php';
include_once '../sys/inc/tfoot.php';
?>