<?php 

@session_start();


	if($_SESSION['SECEXP'] !=''){

	}else{
		echo "Go And Fuck Your Self";die;
	}
	
	if($_REQUEST['logout'] == 1){
		$sqlL = 'UPDATE '.$DB->pre.'user_logs SET logStatus="0" WHERE userID="'.$_REQUEST['retID'].'"';
		$DB->dbQuery($sqlL);
	}
?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=11" >
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="<?php echo SITEURL?>/css/ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="<?php echo SITEURL?>/css/ie7.css">
<![endif]-->
<link rel="stylesheet" type="text/css" href="<?php echo SITEURL?>/css/ie7.css">

</head>

<body style="background-color:#9BDC74">
	<div class="container">
		<div class="menus">
      <ul style="">
          <?php echo innerAdminMenu()?>
      </ul>
    </div>


		<p><?php echo $_REQUEST['frmdate']?> To <?php echo $_REQUEST['todate']?></p>	
        
        <table border="1px" cellpadding="1px" cellspacing="1" width="98%" style="font-size:20px; background-color:#fff;">
        <tr>
        	<td>Name</td>
            <td>Type</td>
            <td>Log Time</td>
            <td>IP Address</td>
            <td>Log Out</td>
            
        </tr>
        <?php
        
		 	$sql = 'SELECT U.name,L.ipAddress,L.logTime,U.userType,U.id,max(L.id) as logid FROM '.$DB->pre.'users as U
					LEFT JOIN '.$DB->pre.'user_logs as L on U.id = L.userID 
					WHERE   L.logDate="'.date('Y-m-d').'" AND L.logStatus="1" AND U.id !="1" AND adminID="'.$_REQUEST['id'].'" AND (userType="2" OR userType="3") group by U.name';
			$D = $DB->dbRows($sql);
			
			foreach($D as $D){
				
				?>

                <tr>
		        	<td><?php echo $D['name'];?>
                </td>
            <td><?php 
			 if($D['userType']== '2'){
			 	echo "Agent";
			 }
			 if($D['userType']== '3'){
			 	echo "Retailer";
			 }
			 ?></td>
             <td><?php echo $D['logTime']?></td>
            <td><?php echo $D['ipAddress']?></td>
            <td><a href="<?php echo SITEURL?>/live-list/?u=<?php echo $_REQUEST['u']?>&flag=1&id=<?php echo $_REQUEST['id']?>&retID=<?php echo $D['id']?>&logout=1"><input id="btnLogout" name="btnLogout" type="button" value="Logout"></a></td>
            <td></td>
        </tr>
                <?php
				}
			
			
		
		?>
        </table>
			

	</div>

</body>
</html>
