<?php
spl_autoload_register(function($class) {
include("classess/".$class.".php");
});
$sqlfun = new sqlfunction();
$admin = new admin_login();
$admin->security_check();
$sid = $admin->call_session();
$getdate =$admin->getdates();
ob_start();
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>MKO</title>
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.7 -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="css/font-awesome.min.css">
<!-- Ionicons -->
<!--<link rel="stylesheet" href="css/ionicons.min.css">-->
<!-- Theme style -->
<link rel="stylesheet" href="css/AdminLTE.min.css">
<link rel="stylesheet" href="css/_all-skins.min.css">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap-datepicker.min.css">
<link rel="stylesheet" type="text/css" href="css/summernote.css">
<script src="js/jquery.min.js"></script>
<script src="js/jquery-ui.min.js"></script>
<script src="js/bootstrap-datepicker.min.js"></script>
<script type="text/javascript" src="js/summernote.min.js"></script>
<!-- Google Font -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<?php include('header.php');?>
<?php include('sidebar.php');?>
<?php
$succ = "";
if(isset($_GET['delid'])){
$delid = base64_decode($_GET['delid']);
$cnd1 = " id='$delid'";
if($sqlfun->del_data("game",$cnd1))
{
$succ="<div class='alert alert-success hideee'><span><b>Success! </b>Deleted successfully</span><a href='#' class='close' data-dismiss='alert'>×</a></div>";
?>
<script>setTimeout(function(){ $('.hideee').hide(); }, 2000);</script>
<?php }
else
{
$succ = "<p style = 'color:green;'>Something went wrong</p>";
}
}
?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<div class="content-header">
<h1> Players </h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
<li class="active">Players</li>
</ol>
</div>
<!-- Main content -->
<div class="content body">
<div class="row">
<div class="col-md-12">
<div class="box box-danger">
<div class="box-header with-border">
<?php
if(isset($_POST['submit'])){
// $from_date=$_REQUEST['start_date'];
$filter_type=$_REQUEST['filter_type'];
if($filter_type=='mobile'){
$from_date = date('d-m-Y');
$phone=$_REQUEST['phonnumber'];
$cnd12 = "p_mobile = '$phone'";
}else{
$from_date=$_REQUEST['start_date'];
$from_dat = date('Y-m-d',strtotime($from_date));
$cnd12 = "reg_date = '$from_dat' order by p_id DESC";
}
}else{
$from_date = date('d-m-Y');
$filter_type='';
$cnd12 = "status = '1' order by p_id DESC";
}
?>
<form method="post">
<div class="form-row">
<div class="col-md-4">
<div class="form-group">
<label class="control-label">Filter type</label>
<select class="form-control" id = "filter_type" name="filter_type" required="">
<option value="date" <?php if($filter_type == 'date'){echo 'selected';}?>>Date Wise</option>
<option value="mobile" <?php if($filter_type == 'mobile'){echo 'selected';}?>>Mobile No.</option>
</select>
</div>
</div>
<div class="col-md-4">
<div class="form-group" id="datediv">
<label class="control-label"> Date</label>
<input class="form-control myinput" id="datepicker" name="start_date" value="<?php echo $from_date; ?>" required type="text">
</div>
<div class="form-group" id="phonediv">
<label class="control-label"> Phone</label>
<input class="form-control myinput" id = "phone" name="phonnumber" value="<?=$phone?>" type="number">
</div>
</div>
<div class="col-md-4">
<br>
<button style=" margin-top: 8px;" type="submit" name="submit" class="btn btn-outline-primary"><i class="feather icon-file mr-2"></i> Search Now</button>
</div>
</div>
</form>
</div><!-- /.box-header -->
<div class="box-body">
<button type="button" id = "excel_button" class="btn btn-secondary waves-effect tt">Export</button>
<div class="table-responsive">
<table class="table table-bordered export_table">
<thead>
<tr>
<th>Sno.</th>
<th>Join Date</th>
<th>Parent ID</th>
<th>Pid</th>
<th>Player Name</th>
<th>Mobile No.</th>
<th>Available Balance </th>
<th>Rate</th>
<th>Total Child</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$i = 1;
$check12 = $sqlfun->fetchdata("player",$cnd12);
while($row12 = $check12->fetch(PDO::FETCH_OBJ))
{
$row_id = $row12->p_id;
$parent_id = $row12->parent_id;
?>
<tr>
<td><?=$i++;?></td>
<td><?=$row12->reg_date?></td>
<td><?php
if($parent_id != ""){
echo $parent_id;
}
else
{
echo "Self registration";
}
?>
</td>
<td><?=$row12->code?></td>
<td><?=$row12->p_f_name?></td>
<td><?=$row12->p_mobile?></td>
<td><?=$row12->wallet?> </td>
<td>
<input type = "number" min = "1" id = "rate<?=$row12->p_id?>" name = "rate" value = "<?=$row12->rate?>">
<input type = "hidden" id = "p_name<?=$row12->p_id?>" value = "<?=$row12->p_f_name?>">
<button class = "button btn btn-primary" id = "<?=$row12->p_id?>">Update</button>
</td>
<td>
<?php
$cnd0000 = "parent_id = '$row_id'";
$check0000 = $sqlfun->fetchdata("player",$cnd0000);
if($check0000->rowCount() > 0)
{?>
<a href = 'child.php?parent_id=<?=$row_id?>&name=<?=$row12->p_f_name?>'><?php echo $check0000->rowCount();?></a>
<?php }
else
{
echo $check0000->rowCount();
}
?>
</a>
</td>
<?php
$cnd890 = "";
$check890 = $sqlfun->fetchdata("message",$cnd890);
$row890 = $check890->fetch(PDO::FETCH_OBJ);
$download = $row890->download;
?>
<td><a target = "_blank" href="https://api.whatsapp.com/send?phone=91<?=$row12->p_mobile?>&text=<?=$download?>" id="" class="btn btn-primary btn-sm btn-flat"><i class="fa fa-whatsapp"></i> Send</a></td>
</tr>
<?php }?>
</tbody>
</table>
</div>
<!-- Pagination -->
<nav aria-label="Page navigation">
<ul class="pagination">
<?php if ($currentPage > 1): ?>
<li class="page-item"><a class="page-link" href="?page=<?= $currentPage - 1 ?>">Previous</a></li>
<?php endif; ?>
<?php for ($page = 1; $page <= $totalPages; $page++): ?>
<li class="page-item <?= $page == $currentPage ? 'active' : '' ?>"><a class="page-link" href="?page=<?= $page ?>"><?= $page ?></a></li>
<?php endfor; ?>
<?php if ($currentPage < $totalPages): ?>
<li class="page-item"><a class="page-link" href="?page=<?= $currentPage + 1 ?>">Next</a></li>
<?php endif; ?>
</ul>
</nav>
</div><!-- /.box-body -->
</div><!-- /.box -->
</div><!-- /.col -->
</div>
</div>
<!-- ============================================================= --> </div><!-- /.content-wrapper -->
<?php include('footer.php');?>
</div><!-- ./wrapper -->
<!-- jQuery 3 -->
<!-- Bootstrap 3.3.7 -->
<script src="js/bootstrap.min.js"></script>
<!-- FastClick -->
<!--<script src="js/fastclick.min.js"></script>-->
<!-- AdminLTE App -->
<!--<script src="js/adminlte.min.js"></script>-->
<!-- SlimScroll -->
<script src="js/jquery.slimscroll.min.js"></script>
<!--<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script>-->
<!--<script src="js/docs.js"></script>-->
<script src="js/jquery.dataTables.min.js"></script>
<script src="js/dataTables.bootstrap.min.js"></script>
<!-- FastClick -->
<script src="js/fastclick.js"></script>
<!-- AdminLTE App -->
<script src="js/adminlte.min.js"></script>
<!--<script src="js/dashboard2.js"></script>-->
<!--<script src="js/demo.js"></script>-->
<script>
$(document).ready(function () {
$('.sidebar-menu').tree();
$('.datatable').DataTable();
$('#datatable1').DataTable();
$('#datatable2').DataTable();
$('#datatable3').DataTable();
$('#editor1').summernote({ height: 200 });
// $('#editor2').summernote({ height: 200 });
});
$(document).ready(function () {
$('#datepicker').datepicker({
autoclose: true,
format:'dd-mm-yyyy'
// startDate:'1990-20-08',
// endDate:'1993-20-08'
});
$('#datepicker1').datepicker({ autoclose: true, format:'dd-mm-yyyy' });
$('#datepicker2').datepicker({ autoclose: true, format:'dd-mm-yyyy' });
});
$('#phonediv').hide();
$("#filter_type").on('change',function(){
var option = $('#filter_type').find(":selected").val();
if(option == "mobile")
{
$('#phonediv').show();
$('#datediv').hide();
$('#phone').attr("required","required");
$('#datepicker').removeAttr("required");
}
else
{
$('#phonediv').hide();
$('#datediv').show();
$('#phone').removeAttr("required");
$('#datepicker').attr("required","required");
}
});
//ready document
$(document).ready(function(){
var option = $('#filter_type').find(":selected").val();
if(option == "mobile")
{
$('#phonediv').show();
$('#datediv').hide();
$('#phone').attr("required","required");
$('#datepicker').removeAttr("required");
}
else
{
$('#phonediv').hide();
$('#datediv').show();
$('#phone').removeAttr("required");
$('#datepicker').attr("required","required");
}
});
</script>
<script src="//cdn.rawgit.com/rainabba/jquery-table2excel/1.1.0/dist/jquery.table2excel.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#excel_button').click(function(){
$('.export_table').table2excel({
name: "Players",
filename: "Players",
fileext: ".xls"
});
});
});
$(".button").on("click",function()
{
var row_idi = $(this).attr("id");
// alert(row_idi);
var rate = $("#rate"+row_idi).val();
var p_name = $("#p_name"+row_idi).val();
// alert(p_name);
// alert(rate);
$.ajax({
method:"POST",
url:"player_ajax.php",
data:{"rate":rate,"player_idi":row_idi},
success:function(res)
{
if(res == "1")
{
alert("Rate "+rate+" updated successfully for "+p_name);
}
}
});
});
</script>
</body>
</html>