	<?php
function getGallery(){
	global $DB;
	$sql = "SELECT * FROM ".$DB->pre."home_gallery WHERE status=1";
	$data = $DB->dbRows($sql);
	$str = "";
	foreach($data as $v){
		$str .='<a class="fancybox" rel="gallery1" href="'.SITEURL.'/uploads/home_gallery/'.$v['homeImg'].'">
			<img src="'.SITEURL.'/core/image.inc.php?path=home_gallery/'.$v['homeImg'].'&w=720&h=478&type=crop'.'" alt="" />
			</a>';
	}
	return $str;
}
function innerAdminMenuHome(){

@session_start();
  
	global $DB;
 $sql = 'SELECT U.name,L.ipAddress,L.logTime,U.userType,U.id 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")';
			$D = $DB->dbRows($sql);
$str = '
	<li><a class="active" href="'.SITEURL.'/agent/?u='.$_REQUEST['u'].'&flag='.$_REQUEST['flag'].'&id='.$_REQUEST['id'].'">Home </a></li>
	<li><a href="'.SITEURL.'/agent-list1/?u='.$_REQUEST['u'].'&flag='.$_REQUEST['flag'].'&id='.$_REQUEST['id'].'">Agent </a></li>
				 
				  <li><a href="'.SITEURL.'/balance/?u='.$_REQUEST['u'].'&flag='.$_REQUEST['flag'].'&id='.$_REQUEST['id'].'">Balance </a></li>
				  <li><a href="'.SITEURL.'/live-list/?u='.$_REQUEST['u'].'&flag='.$_REQUEST['flag'].'&id='.$_REQUEST['id'].'">Live('.count($D).') </a></li>
				  <li><a href="'.SITEURL.'/live-betting/?u='.$_REQUEST['u'].'&flag='.$_REQUEST['flag'].'&id='.$_REQUEST['id'].'">Live Beting </a></li>
                  <li><a href="'.SITEURL.'/result/?u='.$_REQUEST['u'].'&flag='.$_REQUEST['flag'].'&id='.$_REQUEST['id'].'">Result </a></li>
                  <li><a href="'.SITEURL.'/only-win/?u='.$_REQUEST['u'].'&flag='.$_REQUEST['flag'].'&id='.$_REQUEST['id'].'">Only WinT </a></li>
                  
                  ';
if($_SESSION['SECEXP'] == 321){				  
			$str .='<li><a href="'.SITEURL.'/ab-list/?u='.$_REQUEST['u'].'&flag='.$_REQUEST['flag'].'&id='.$_REQUEST['id'].'">AB </a></li>
				  <li><a href="'.SITEURL.'/today/?u='.$_REQUEST['u'].'&flag='.$_REQUEST['flag'].'&id='.$_REQUEST['id'].'">Today </a></li>
				  <li><a href="'.SITEURL.'/winning/?u='.$_REQUEST['u'].'&flag='.$_REQUEST['flag'].'&id='.$_REQUEST['id'].'">Winning </a></li>
				  <li><a href="'.SITEURL.'/live-bz/?u='.$_REQUEST['u'].'&flag='.$_REQUEST['flag'].'&id='.$_REQUEST['id'].'">Live BZ </a></li>
				  <li><a href="'.SITEURL.'/barcode/?u='.$_REQUEST['u'].'&flag='.$_REQUEST['flag'].'&id='.$_REQUEST['id'].'">Barcode </a></li>
				  <li><a href="'.SITEURL.'/r-play/?u='.$_REQUEST['u'].'&flag='.$_REQUEST['flag'].'&id='.$_REQUEST['id'].'">R-Play </a></li>
				  
				  <li><a href="#">lastLog </a></li>
				  <li><a href="#">Password </a></li>

';
}


return $str;

}
function getTime(){
	global $DB;
	date_default_timezone_set('Asia/Kolkata');

$date = time();

$lotMin = date("i", $date);
$lotHour = date("h", $date);
$lotSec = date("s", $date);
$ampm = date("A", $date);

$lotHour = $lotHour % 12;
if ($lotHour == 0) {
    $lotHour = 12;
}

if ($lotMin >= 0 && $lotMin < 15) {
    $lotMin = 15;
} else if ($lotMin >= 15 && $lotMin < 30) {
    $lotMin = 30;
} else if ($lotMin >= 30 && $lotMin < 45) {
    $lotMin = 45;
} else if ($lotMin >= 45 && $lotMin < 60) {
    $lotMin = 0;
    $lotHour++;
}


if ($lotHour < 10) {
    $lotHour = "0" . $lotHour;
}
if ($lotMin < 10) {
    $lotMin = "0" . $lotMin;
}
// if ($lotSec < 10) {
//     $lotSec = "0" . $lotSec;
// }

$time_lot = date("Y-m-d", $date) . " $lotHour:$lotMin:$lotSec";
$time_now = date("Y-m-d h:i:s", $date);

// $h = date("h", $date);
$m = $lotMin;
// $s = date("s", $date);

if ($m > 60) {
    $m = $m % 60;
    $h++;
    if ($m < 10) {
        "0" . $m;
    }
}

if ($time_lot == $time_now) {
    echo "Expired";
}
$drawTime = $lotHour.':'.$lotMin;

$sec_remaining =  (60 - date("s", time()));
if ($sec_remaining < 10) {
    $sec_remaining = "0" . $sec_remaining;
}

$min_remaining =  ((strtotime($time_lot) - strtotime($time_now)) / 60) - 1;
if ($min_remaining < 10) {
    $min_remaining = "0" . $min_remaining;
}
$time_remaining = $min_remaining . ":" . $sec_remaining;

//echo "Draw Time: " . $time_lot;
//echo "<br>Curr.. Time: " . $time_now;
echo  $time_remaining.'-'.date('h:i',strtotime($drawTime));

}
switch($_REQUEST['xAction']){
	case 'getTime':
					include("../../connectdb.inc.php");
					echo getTime();
					break;
}
?>