<?
/** 
 * @Project GoldMU.Net
 * @copyright 03/03/2022
 * @Email: goldmu.net@gmail.com
 * @Zalo: 0923 117 898
 */
 

if (isset($_SESSION['mu_username'])) {
    include_once("config/config_support.php");
    if ( $user_support == 1 )
    {
        $support_unread_query = "SELECT * FROM support WHERE sup_read=0 AND supid_parent=0 AND AccountID='$_SESSION['mu_username']'";
        $support_unread_result = mysql_query($support_unread_query);
            check_queryerror($support_unread_query, $support_unread_result);
        $unread = mysql_num_rows($support_unread_result);
        
        $bqtsend_query = "SELECT supid FROM support WHERE AccountID IN ($quantri_support) AND AccountID<>'$_SESSION['mu_username']' AND supid_parent=0";
        $bqtsend_result = mysql_query($bqtsend_query);
            check_queryerror($bqtsend_query, $bqtsend_result);
        while( $bqtsend = mysql_fetch_assoc($bqtsend_result) )
        {
            $check_readbqt_query = "SELECT * FROM support_readbqt WHERE supid=$bqtsend[supid] AND AccountID='$_SESSION['mu_username']'";
            $check_readbqt_result = mysql_query($check_readbqt_query);
                check_queryerror($check_readbqt_query, $check_readbqt_result);
            $readed = mysql_num_rows($check_readbqt_result);
            if( $readed == 0 ) $unread++;
        }
        
        if($unread>0) $unread_richtext = "<font color=red><b>$unread</b></font>";
        else $unread_richtext = $unread;
        
        if( in_array($_SESSION['mu_username'], $quantri_arr )) {  // Neu la BQT
            $support_notans_query = "SELECT * FROM support WHERE sup_status=0 AND supid_parent=0";
            $support_notans_result = mysql_query($support_notans_query);
                check_queryerror($support_notans_query, $support_notans_result);
            $support_notans = mysql_num_rows($support_notans_result);
            
            if($support_notans>0) $support_notans_richtext = "<font color=red><b>$support_notans</b></font>";
            else $support_notans_richtext = $support_notans;
        }    
        include('templates/box_support.tpl');
    }
}

?>