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



switch($sd){
default:

$q1 = mysql_num_rows(mysql_query("SELECT * FROM `us_quest` WHERE `user`='$uid' and `status`='ok'"));
$q2 = mysql_num_rows(mysql_query("SELECT * FROM `us_quest` WHERE `user`='$uid' and `status`='not'"));

if($q2 == '0'){
    echo "У вас нет активных заданий.<br>";
}else{
    echo "<a href='my_quest.php?sd=activ'>Активные задания</a> ($q2)<br>";
}
if($q1 == '0'){
    echo "Вы ещё не завершили ни одного задания.<br>";
}else{
    echo "<a href='my_quest.php?sd=end'>Завершенные задания</a> ($q1)<br>";
}

break;


case 'activ':

$q = mysql_query("SELECT * FROM `us_quest` WHERE `user`='$uid' and `status`='not'");
$e = mysql_num_rows($q);
if($e == '0'){
    echo "У вас нет активных заданий.<br>";
    include ('tmp/foot.php');
    exit;
}

While($w = mysql_fetch_assoc($q)){
    
    if($w['exp'] !== '0'){$wexp = "<img src='/img/exp.png'><font color=darkorange>$w[exp]</font>";}
    if($w['money'] !== '0'){$wmoney = " <img src='/img/money.png'><font color=silver>$w[money]</font>";}
    if($w['gold'] !== '0'){$wgold = " <img src='/img/gold.png'><font color=gold>$w[gold]</font>";}
    
    echo "<div class='quest'><font color=#f4d06e>$w[name]</font><br><font color=#f4d06e>Награда:</font> $wexp$wmoney$wgold<br><font color=#f4d06e>Условие:</font> $w[text]</div>";
    
}

echo "<br><a href='my_quest.php?'>Назад</a><br>";

break;



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