<?php 

@session_start();


	if($_REQUEST['id'] !=''){

	}else{
		die;
	}
?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link rel="stylesheet" type="text/css" href="<?php echo SITEURL?>/css/style.css">
<script type="text/x-javascript" src="<?php echo SITEURL?>/js/jquery.min1.js"></script>
<script type="text/x-javascript" src="<?php echo SITEURL?>/mod/page/x-page.inc.js"></script>

</head>

<body style="background-color:#9BDC74">
	<div class="container">
		<div class="row inline">
			<div class="navstyle">
				<li>Date 
					<input type="date" name="Date">
					to 
					<input type="date" name="Date">
					&nbsp;
					<button class="btn" type="button" name="Screen">Screen </button>
					<button class="btn" type="button" name="Screen">Print </button>
					<button class="btn" type="button" name="Screen">Exit </button>
						<a class="timer" id="timer"></a>
                        
<input id="hideAdminID" name="hideAdminID" type="hidden" value="<?php echo $_REQUEST['id']?>">
                        <input id="hideDrawTime" name="hideDrawTime" type="hidden" value="<?php echo drawTime();?>">
						<a href="#"><img src="<?php echo SITEURL?>/images/admin.jpg"></a>
				</li>

				
			</div>
			<div class="menus">
			<ul>
				 <?php echo innerAdminMenu()?>
			</ul>
		</div>

		</div>


		<p><?php echo date('d-M-Y')?> To <?php echo date('d-M-Y')?></p>	
        
        <table border="1px" cellpadding="1px" cellspacing="1" width="98%" style="font-size:20px; background-color:#fff;">
        <tr>
        	<td>Agent Name</td>
            <td>Retailer Name</td>
            <td>Last Update</td>
            <td>...</td>
            <td>IP Address</td>
            <td>De-Activate</td>
            <td>Log Out</td>
            <td>Today</td>
            
        </tr>
        <?php
        
			$sql = 'SELECT * FROM '.$DB->pre.'users WHERE   userType="2" AND underHead="'.$_REQUEST['id'].'"';
			$D = $DB->dbRows($sql);
			
			foreach($D as $D){
				?>
                <tr>
		        	<td>
                    <?php
						$sqlS = 'SELECT name FROM '.$DB->pre.'users WHERE underHead="'.$D['underHead'].'"';
						$S = $DB->dbRow($sqlS);
						echo $S['userCode'];
					?>
                </td>
            <td><?php echo $D['userCode']?></td>
            <td><?php echo $D['dateModified']?></td>
            <td>0</td>
            <td>127.00.00.0</td>
            <td><input id="btnDe-Active" name="btnDe-Active" type="button" value="De-Activate"></td>
            <td><input id="btnLogout" name="btnLogout" type="button" value="Logout"></td>
            <td></td>
        </tr>
                <?php
			}
			
			
			
		
		?>
         <?php
					  $str = '';
                      	function getAgentUserLive($ID){
							global $DB;
							$sql = 'SELECT * FROM '.$DB->pre.'users WHERE underHead="'.$ID.'"';
							$D = $DB->dbRows($sql);
							foreach($D as $D){
								if($D['id'] !=''){
								$str .= '
									<tr>
										<td>1</td>
										<td><a href="'.SITEURL.'/lottery-agent/create-agent/?userID='.$D['id'].'&u='.$_REQUEST['u'].'&flag='.$_REQUEST['flag'].'&id='.$_REQUEST['id'].'">'.$D['userCode'].'</a></td>
										<td>MH2021 </td>                    
										<td>User </td>                    
										<td>23-01-2021 15:28:74 </td>                    
										<td>0 </td>                    
										<td>0 </td>                    
										<td>0 </td>                   
									  </tr>
								
								';
									getAgentUserLive($D['id']);
								}
							}
							return $str;
						}
						?>
        </table>
			

	</div>

</body>
</html>
