<?php
if(isset($_GET['select']) && intval($_GET['select'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `icon_user` WHERE `id` = '".intval($_GET['select'])."' AND `id_user` = '$ku[id]'"),0)!=0)
{
$icon=mysql_fetch_array(mysql_query("SELECT * FROM `icon_user` WHERE `id` = '".intval($_GET['select'])."' AND `id_user` = '$ku[id]' AND (`pol` = '$ku[pol]' or `pol` = '3')"));
if($icon['exp']>=$ku['iconExp'])$exp=$icon['exp'];
if($icon['exp']<$ku['iconExp'])$exp=$ku['iconExp'];
mysql_query("UPDATE `kolhoz_user` SET  `icon` = '$icon[icon]', `iconExp` = '$exp'  WHERE `id` = '$ku[id]'");
$_SESSION['msg']='Иконка изменена!:)';
header("Location:/?icon");
}
echo'<div class="event"><h1>Мои иконки <a href="/forum-350"><img src="https://cdn3.iconfinder.com/data/icons/social-7/500/Help_mark_query_question_support_talk-24.png"></a></h1></div>
<div class="block">Ваш бонус от иконки: <span class="title">'.$ku['iconExp'].' %</span></div>
<div class="block"><img width="20" src="/images/icon/7.png"> <a href="/icon"> Все иконки</a></div><div class="block">';
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM  `icon_user` WHERE `id_user` = '$ku[id]' AND (`pol` = '$ku[pol]' or `pol` = '3')"),0);
    if($k_post==0){
        echo "<div class='block'>пустo...</div>";
    }
    $set['p_str']=8;
    $k_page=k_page($k_post,$set['p_str']);
    $page=page($k_page);
    $start=$set['p_str']*$page-$set['p_str'];  
$result1 = mysql_query("SELECT * FROM `icon_user` WHERE `id_user` = '$ku[id]' AND (`pol` = '$ku[pol]' or `pol` = '3') ORDER BY `id` ASC LIMIT $start, 8");
while($post = mysql_fetch_assoc($result1)){

  echo "<li style='padding-bottom:8px'>";
echo "<img width='35' height='35' src='images/icon/$post[icon].png' alt='o' class='portrait'>";
echo "<div class='smallsss'>";
echo "<a href='/me_icon/select-$post[id]'><span>Выбрать</span></a></div>
<div class='smallss minor'> Бонус опыта: <span class='title'>".($post['exp'])."%</span></div></li>";


}
echo "</ul>";

    if ($k_page>1)
    {
        echo'</div><div class="block">';

        str("?me_icon&",$k_page,$page); // Вывод страниц
    echo'</div>';
    }
    echo "</div>";

?>