<?php
session_start();
include ('private/mysql.php');
include ('tmp/head.php');


switch($sd){
default:


echo "<b><font color=yellow>Зоны охоты:</font></b><br><ul class='list_page'><div class='linem'></div>";

$q = mysql_query("SELECT * FROM `location` WHERE `tip`='hunter'");
while($w = mysql_fetch_assoc($q)){
    
    if($user['level'] >= $w['m1']){$a = "<a href='location.php?sd=set&id=$w[id]'>$w[name] <span style='float:right'>$w[m1] - $w[m2] ур.</span></a>";}else{$a = "<font size=1 color=grey>$w[name] <span style='float:right'>$w[m1] - $w[m2] ур.</span></font>";}
    
    echo "<li><small>$a</small></li>";
    
}
echo "</ul><div class='linem2'></div>";

break;


case 'set':

$q = mysql_query("SELECT * FROM `location` WHERE `id`='$id'");
$e = mysql_num_rows($q);
$h = mysql_fetch_assoc($q);
if($e == 0){
    header('Location: location.php');
    exit;
}


if($user['level'] < $h['m1']){
    header('Location: location.php');
    exit;
}



mysql_query('UPDATE `users` SET `hunter`='.$h[id].' WHERE `id`='.$uid.'') or die(mysql_error());

header('Location: hunter.php');
exit;

break;


}
include ('tmp/foot.php');
?>