<?
 $badge= mysql_fetch_array(mysql_query("SELECT * FROM `badge` WHERE `id_user` = '$ku[id]'"));
 if(isset($_GET['set']) && ($_GET['set']<6))
 {
     if($_GET['set']==1 && ($badge['NewYear']==1))
     {
                   mysql_query("UPDATE `kolhoz_user` SET `badge` =  'NewYear' WHERE `id` = '".$ku['id']."'");
      $_SESSION['msg']='Значок изменен!';
  
header('location:/?badge'); 
         
     }
        if($_GET['set']==2 && ($badge['mvp']==1))
     {
                   mysql_query("UPDATE `kolhoz_user` SET `badge` =  'MVP' WHERE `id` = '".$ku['id']."'");
          $_SESSION['msg']='Значок изменен!';
  
header('location:/?badge'); 
         
     }
     if(($_GET['set']==3) && ($badge['chat']==1))
     {
                   mysql_query("UPDATE `kolhoz_user` SET `badge` =  'chat' WHERE `id` = '".$ku['id']."'");
      $_SESSION['msg']='Значок изменен!';
  
header('location:/?badge'); 
         
     }
       if($_GET['set']==4 && ($badge['forum']==1))
     {
                   mysql_query("UPDATE `kolhoz_user` SET `badge` =  'forum' WHERE `id` = '".$ku['id']."'");
      $_SESSION['msg']='Значок изменен!';
  
header('location:/?badge'); 
         
     }
       if($_GET['set']==5 && ($badge['red_star']==1))
     {
                   mysql_query("UPDATE `kolhoz_user` SET `badge` =  'red_star' WHERE `id` = '".$ku['id']."'");
      $_SESSION['msg']='Значок изменен!';
  
header('location:/?badge'); 
         
     }
 }
 echo'<div class="event"><h1>Значки</h1></div>';
 echo'<div class="block">Значки можно получить по <span class="title">различным ивентам</span>, а так же на усмотрение администрации<br>Выбранный значок отображается возле ника.</div>';
 if($badge['NewYear']==1)echo'<div class="block"><img width="18" src="/pavelgrey/img/badge/NewYear.png"> Значок <span class="title">«Игрушка»</span> <a href="/?badge&set=1">[выбрать]</a></div>';
 if($badge['mvp']==1)echo'<div class="block"><img width="18" src="/pavelgrey/img/badge/MVP.png"> Значок <span class="title">«MVP»</span> <a href="/?badge&set=2">[выбрать]</a></div>';
 if($badge['forum']==1)echo'<div class="block"><img width="18" src="/pavelgrey/img/badge/forum.png"> Значок <span class="title">«Форумчанин»</span> <a href="/?badge&set=4">[выбрать]</a></div>';
 if($badge['chat']==1)echo'<div class="block"><img width="18" src="/pavelgrey/img/badge/chat.png"> Значок <span class="title">«Чатовчанин»</span> <a href="/?badge&set=3">[выбрать]</a></div>';
 if($badge['red_star']==1)echo'<div class="block"><img width="18" src="/pavelgrey/img/badge/red_star.png"> Значок <span class="title">«Опытный»</span> <a href="/?badge&set=5">[выбрать]</a></div>';

 ?>

