<?php
@session_start();

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

	}else{
		//echo "Go And Fuck Your Self";die;
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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:#fff;">
	<div class="container">
		<div class="menus">
          
        </div>
		
		<div class="row">
			<div style="margin-top:5px;">
            <form id="frmReplay" name="frmReplay" method="GET" action="<?php echo SITEURL?>/r-play">
           
            	<table border="1px" width="100%" >
                	<tr>
                    	<td>From Date</td>
                    	<td><input id="frmdate" name="frmdate" type="date" required></td>
                      </tr>
                      <tr>
                        <td>To</td>
                        <td><input id="todate" name="todate" type="date" required></td>
                    </tr>
                    <tr>
                    	<td colspan="2" align="center"><input id="btnDelete" name="btnDelete" type="submit" value="Delete" style="width: 20%;
height: 30px;font-size: 16px;background-color: crimson;color: #fff;font-weight: bold;border-radius: 8px;"></td>
                    </tr>
                </table>
                
			</div>
            
            			
            
            
            
            				
</form>
		</div>
<?php 
			if(isset($_REQUEST['btnDelete'])){
				if($_REQUEST['frmdate'] !='' && $_REQUEST['todate'] !=''){
				if(date('Y-m-d',strtotime($_REQUEST['frmdate'])) < date('Y-m-d',strtotime("-1 days")) && date('Y-m-d',strtotime($_REQUEST['todate'])) < date('Y-m-d',strtotime("-1 days"))){
					 $sqlR = 'DELETE FROM '.$DB->pre.'lottary WHERE lotdate >="'.date('Y-m-d',strtotime($_REQUEST['frmdate'])).'" AND lotdate <="'.date('Y-m-d',strtotime($_REQUEST['todate'])).'"';
					$DB->dbQuery($sqlR);
					
					 $sqlR2 = 'DELETE FROM '.$DB->pre.'result_tran WHERE lotdate >="'.date('Y-m-d',strtotime($_REQUEST['frmdate'])).'" AND lotdate <="'.date('Y-m-d',strtotime($_REQUEST['todate'])).'"';
					$DB->dbQuery($sqlR2);
					
					 $sqlR3 = 'DELETE FROM '.$DB->pre.'result_win WHERE lotdate >="'.date('Y-m-d',strtotime($_REQUEST['frmdate'])).'" AND lotdate <="'.date('Y-m-d',strtotime($_REQUEST['todate'])).'"';
					$DB->dbQuery($sqlR3);
					
					
					
					
					echo "<p style='background: brown;width: 37%;height: 25px;text-align: center;font-size: 26px;color: white;
font-weight: bold;padding: 4px;border-radius: 8px;'>Record Is Deleted </p>";
				}else{
					echo "<p style='background: brown;width: 37%;height: 25px;text-align: center;font-size: 26px;color: white;
font-weight: bold;padding: 4px;border-radius: 8px;'>Please select date Before ".date('Y-m-d',strtotime("-8 days")).'</p>';
				}
				}else{
					
					echo "<p style='background: brown;width: 37%;height: 25px;text-align: center;font-size: 26px;color: white;
font-weight: bold;padding: 4px;border-radius: 8px;'>Please Select Date </p>";
				
				}
					
					
		
				
				
			}
		?>
	</div>
    <script type="text/javascript">
	function setDelID(){
		var flag = document.getElementById('rodDelete').checked;
		var chk = document.querySelectorAll("input[type=checkbox]");
		if(flag){	
			for (i = 0; i <	chk.length; i++) {
				chk[i].checked = true;
			}

		}else{
			for (i = 0; i <	chk.length; i++) {
				chk[i].checked = false;
			}
		}
	}
    </script>
<!--<script type="text/javascript">
$('document').ready(function(e) {
	var multiID = '';
	$('#rodDelete').click(function(){

 	multiID= '';
 	if($(this).is(':checked')){
 		$('.cls-delete').each(function() {
                var cur = $(this);
                var attr = $(this).attr('disabled');
                if(attr !='disabled'){
                	multiID += cur.val()+',';
                	cur.prop('checked',true);	
                }
        });
 	}else{
		multiID = '';
		$('.cls-delete').each(function() {
			var cur = $(this);
			var attr = $(this).attr('disabled');
			if(attr !='disabled'){
				cur.prop('checked',false);	
			}      
		});
 	}
 }) ;
 
 $('.cls-delete').click(function(){
	 var cur1 = $(this);
	 if($(this).is(':checked')){
		 multiID += cur1.val()+",";
	 }else{
		 var val = cur1.val()
	 	//multiID.replace("/"+val+"/gi",' ');
		
	 }
	 
 });
 var SITEURL = "http://localhost/mr-admin"
 $('#btnDelete').click(function(){
	 
	 var aUrl = SITEURL+"/mod/page/x-page.inc.php?xAction=deleteLot&ID="+multiID;
	 alert(aUrl);
	 $.ajax({
		 type:'GET',
		 url:aUrl,
		 success: function(str){
			 var data = $.parseJSON(str);
			 if(data.str == 'OK'){
			 	location.reload();
			 }
		 }
	 });
	 
 });
    
});
</script>-->
</body>
</html>
