<?

//==========================================Действия
if(isset($_GET['my'])){





//======Очистка ОБЩЕГО журнала
if(isset($_GET['end'])){echo "<div class='feedback'><ul class='feedbackPanel'><li class='feedbackPanelINFO'><span class='feedbackPanelINFO'>Журнал успешно очищен!</span></li></ul></div>";}
$cena=50;
if(isset($_GET['clean']))
{
if($ku['rubies']>=$cena)
{
if(isset($_GET['ok']))
{
mysql_querll("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']-$cena)."' WHERE `id` = '$ku[id]'");
mysql_querll("DELETE FROM `kolhoz_jurnal` WHERE `id_user` = '$ku[id]'");
header("Location:?user=$ku[id]&journal&my&end");
}
else
{
podtv("?user=$ku[id]&journal&my&clean&ok","?user=$ku[id]&journal&my");
include_once 'inc/foot.php';
}
}
else no_rubies($cena-$ku['rubies']);
}

echo "<div class='event'><h1>Журнал действий</h1></div>";
echo "<div class='content'>";
echo "<div class='block'>";
echo "<div class='block'><a href='?user=$ku[id]&journal'>Садовники</a> | <b>Действия</b></div>";
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_jurnal` WHERE `id_user` = '$ku[id]'"),0);
if ($k_post==0)
{
echo "Журнал пуст...";
}
$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 `kolhoz_jurnal` WHERE `id_user` = '$ku[id]' ORDER BY `time` DESC LIMIT $start, $set[p_str]");
while($post=mysql_fetch_assoc($q))
{
echo '<div class="block"><span class="epic">Вы'.$post['garden'].'</span> '.output_text($post['works'], $post['id_user']).' <br/><span class="minor"><span>'.time_left($time-$post['time']).' назад</span></span></div>';
}
if ($k_page>1)str("?user=$ank[id]&journal&my&",$k_page,$page); // Вывод страниц
echo "<div class='pt'><img width='16' height='16' src='img/icons/tick.png' alt='o'> <a href='?user=$ku[id]&journal&my&clean'><span>Очистить журнал</span></a> (<span>Стоимость</span>: <span><img width='16' height='16' src='img/icons/ruby.png' alt='o'> <span class='title'>$cena</span></span>)</div>";
echo '</div></div>';




include_once 'inc/foot.php';
}










//**************************============*********************=====================**************



//======Очистка журнала
if(isset($_GET['end'])){echo "<div class='feedback'><ul class='feedbackPanel'><li class='feedbackPanelINFO'><span class='feedbackPanelINFO'>Журнал успешно очищен!</span></li></ul></div>";}
$cena=50;
if(isset($_GET['cleans']))
{
if($ku['rubies']>=$cena)
{
if(isset($_GET['ok']))
{
mysql_querll("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']-$cena)."' WHERE `id` = '$ku[id]'");
mysql_querll("DELETE FROM `kolhoz_journal` WHERE `id_user` = '$ku[id]'");
header("Location:?user=$ku[id]&journal&end");
}
else
{
podtv("?user=$ku[id]&journal&cleans&ok","?user=$ku[id]&journal");
include_once 'inc/foot.php';
}
}
else no_rubies($cena-$ku['rubies']);
}

echo "<div class='event'><h1>Журнал</h1></div>";
echo "<div class='content'>";
echo "<div class='block'>";
echo "<div class='block'><b>Садовники</b> | <a href='?user=$ku[id]&journal&my'>Действия</a></div>";
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_journal` WHERE `id_user` = '$ku[id]'"),0);
if ($k_post==0)
{
echo "Журнал пуст...";
}
$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 `kolhoz_journal` WHERE `id_user` = '$ku[id]' ORDER BY `time` DESC LIMIT $start, $set[p_str]");
while($post=mysql_fetch_assoc($q))
{
echo '<div class="block"><span class="epic">'.$post['garden'].'</span> '.$post['works'].' <span class="minor"><span>'.time_left($time-$post['time']).' назад</span></span></div>';
}
if ($k_page>1)str("?user=$ank[id]&journal&",$k_page,$page); // Вывод страниц
echo "<div class='pt'><img width='16' height='16' src='img/icons/tick.png' alt='o'> <a href='?user=$ku[id]&journal&cleans'><span>Очистить журнал</span></a> (<span>Стоимость</span>: <span><img width='16' height='16' src='img/icons/ruby.png' alt='o'> <span class='title'>$cena</span></span>)</div>";
echo '</div></div>';
include_once 'inc/foot.php';

?>