<?php
    /* Revision de accesos de seguridad */
    include("./api/connection.php");
    $sessid = $_REQUEST["sessid"];
    
    $sql = "SELECT accs_users, accs_customers, accs_invoices,  accs_approve, accs_refuse, accs_reports ".
           "FROM users ".
           "WHERE users.sessionid = '" . $sessid ."'"; 

    if (($qry = mysqli_query($db, $sql))){
        $rs = mysqli_fetch_array($qry);
        $accs_users     = $rs["accs_users"]*1;
        $accs_customers = $rs["accs_customers"]*1;
        $accs_invoices  = $rs["accs_invoices"]*1;
        $accs_approve   = $rs["accs_approve"]*1;
        $accs_refuse    = $rs["accs_refuse"]*1;
        $accs_reports   = $rs["accs_reports"]*1;
    }else{
        $accs_users     = 0;
        $accs_customers = 0;
        $accs_invoices  = 0;
        $accs_approve   = 0;
        $accs_refuse    = 0;
        $accs_reports   = 0;
    }

?>

<div class="cb_thead">
    <div class="cbh_trow">
	    <div class="cbh_logo"></div>
	    <div class="cbh_scenter"></div>
	    <div class="cbh_usrpic"></div>
	    <div class="cbh_usrnam"><?=$username?></div>
	    <div class="cbh_usrmnu">
	        <div id="mnuico" class="cbh_usrmnuico"> <i class="fas fa-angle-down"></i> </div>    
            <div class="cbh_menuarea">
	            <div id="menu" class="cbh_menubox" style="display:none">
	                <?
	                    if($accs_approve == 1){echo('<div id="accs_a" style="display:none">.</div>');}
	                    if($accs_refuse  == 1){echo('<div id="accs_r" style="display:none">.</div>');}
	                    if($accs_reports == 1){echo('<div id="accs_p" style="display:none">.</div>');}
	                ?>
	                <div id="usrmnu1" class="cbh_usrmnuitem">Clientes&nbsp;&nbsp;</div>
                    <div id="usrmnu2" class="cbh_usrmnuitem">Facturas&nbsp;</div>
                    <div id="usrmnu9" class="cbh_usrmnuitem">Usuarios&nbsp;</div>
                    
	                <div id="logout"  class="cbh_usrmnuitem">Salir&nbsp;</div>
	            </div> 
            </div>
	    </div>
    </div>
    <div class="cbh_trow" style="height:5px"></div>
</div> 
