Файл: tankon.mobi/tanks/news.php
Строк: 103
<?
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';
include_once '../sys/inc/thead.php';
title();
err();
aut();
echo '<link rel="stylesheet" href="style.css" type="text/css" />';
include_once 'function.php';
if($tanks_code['news']==0){mysql_query("UPDATE `tanks` SET `news`='1' WHERE `id`='".$user['id']."' ");}
if($tanks_code['id']==1){
if (isset($_POST['msg']) && isset($user))
{
mysql_query("UPDATE `tanks` SET `chat`='1'");
$msg=$_POST['msg'];
if (strlen2($msg)>2048){$errs=1;
err_game("Слишком длинное сообщение");
}
elseif (strlen2($msg)<2){
$errs=1;
err_game("Короткое сообщение");}
elseif (mysql_result(mysql_query("SELECT COUNT(*) FROM `tanks_chat` WHERE `id_user` = '$user[id]' AND `msg` = '".my_esc($msg)."' LIMIT 1"),0)!=0){
$errs=1;
err_game("Ваше сообщение повторяет предущее");
}
elseif ($tanks_code['level']<6 && $tanks_code['chaty_time']!=0 && $tanks_code['status']<1)
{
$time_c=time();
$chat_time=time_left($tanks_code['chaty_time']-$time_c);
$errs=1;
err_game("Вы можете писать через ".$chat_time."");
}
elseif(!isset($errs)){
mysql_query("UPDATE `tanks` SET `news`='0'");
mysql_query("INSERT INTO `tanks_news` (id_user, time, msg) values('".$tanks_code['id']."', '$time', '".my_esc($msg)."')");
err_games('Сообщение успешно добавлено');
}
}
}
err();
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `tanks_news`"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q=mysql_query("SELECT * FROM `tanks_news` ORDER BY id DESC LIMIT $start, $set[p_str]");
while ($post = mysql_fetch_assoc($q))
{
if ($tanks_code['status']>=1){
if (isset($_GET['dellmsg']))
{
mysql_query("DELETE FROM `tanks_news` WHERE `id` = '".$_GET['dellmsg']."' LIMIT 1");
header("Location: /news");
}
if (isset($_GET['dellsmsg']))
{
mysql_query("DELETE FROM `tanks_news` WHERE `id_user` = '".$ank['id']."'");
header("Location: /news");
}
}
echo '<div class="trnt-blocks" style="margin-bottom:3px;">
<div class="wrap-content">
<div class=" small white sh_b bold">
<span class="green2">';
echo "<a href='/profile?id=".$post['id_user']."'> ".ansc($post['id_user'])."</a> (".vremja($post['time']).")";
if ($tanks_code['status']>=1){
echo ' <a href="/news?dellmsg='.$post['id'].'">[удалить]</a>';
}
echo '</span>
';
echo '<br>'.output_text($post['msg'])."<br />";
echo '
</div>
<div class="clrb"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>';
}
if ($k_page>1)str('?',$k_page,$page); // Вывод страниц
if ($tanks_code['status']>=2){
if (isset($user) || (isset($set['write_guest']) && $set['write_guest']==1 && (!isset($_SESSION['antiflood']) || $_SESSION['antiflood']<$time-300)))
{
echo "<form method="post" name='message' action="?$passgen">n";
echo '<div class="p5">
<div class="cntr mb2"><div class="trnt-block">
<div class="wrap1"><div class="wrap2"><div class="wrap3"><div class="wrap4"><div class="wrap5"><div class="wrap6"><div class="wrap7"><div class="wrap8">
<div class="wrap-content">';
echo "<textarea name="msg"></textarea>";
echo'<div class="bot">
<span class="input-but border"><span>';
echo "<input value="Отправить" class='w100' type="submit" /></span></span>
</div>";
echo'</div>
<div class="clrb"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>';echo "</form>n";
}
}
include_once 'foots.php';
?>