<?php 
ob_start();
session_start();
if($_SESSION['userid']=="")
{
	header("location:index.php?msg1=notauthorized");
	exit();
}
	
	?>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Admin | Dashboard</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <!-- Bootstrap 3.3.6 -->
  <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="dist/css/AdminLTE.min.css">
  <!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
  <link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
  <!-- iCheck -->
  <link rel="stylesheet" href="plugins/iCheck/flat/blue.css">
  <!-- Morris chart -->
  <link rel="stylesheet" href="plugins/morris/morris.css">
  <!-- jvectormap -->
  <link rel="stylesheet" href="plugins/jvectormap/jquery-jvectormap-1.2.2.css">
  <!-- Date Picker -->
  <link rel="stylesheet" href="plugins/datepicker/datepicker3.css">
  <!-- Daterange picker -->
  <link rel="stylesheet" href="plugins/daterangepicker/daterangepicker-bs3.css">
  <!-- bootstrap wysihtml5 - text editor -->
  <link rel="stylesheet" href="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">

  <style>
    
    .ims{width:88px;}
      .txt1{
    font-size: 17px;
    font-family: calibri;
      }
       .point{      color: red;
    margin: 12px 14px 2px;
    font-size: 19px;
    font-weight: bold;
    font-family: sans-serif;}
      /*.huge{font-size:17px;}*/
  </style>
</head>
<body class="hold-transition skin-red sidebar-mini">
<div class="wrapper">
<?php include ("include/connection.php");?>
<?php include ("include/header.inc.php");?>
  <!-- Left side column. contains the logo and sidebar -->
 <?php include ("include/navigation.inc.php");
function counter($table){
$rs=mysql_query("select count(*) from `$table`");
$row = mysql_fetch_row($rs);
return $row["0"];
} 
 
 ?> 

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
        Dashboard
        <small>Control panel</small>
        <!--<p class="point">Original Chicken Game available Only Josisoft Technologies <span style="color:green;">Contant Now: +91 8597617361</span></p>-->
      </h1>
      <ol class="breadcrumb">
        <li><a href="desktop.php"><i class="fa fa-dashboard"></i> Home</a></li>
        <li class="active">Dashboard</li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content">
      <!-- Small boxes (Stat box) -->
      <div class="row">
       
      </div>
     
      <!-- /.row (main row) -->
     
<a href="manage_user.php">
    <div class="col-lg-3 col-md-6">
         <div class="panel panel-green">
            <div class="panel-heading">
               <div class="row">
                   
                  <div class="col-xs-3">
                     <!--<i class="fa fa-users fa-3x"></i>-->
                     <img class="ims" style="width:73px;" src="dist/img/1.png">
                  </div>
                  <div class="col-xs-9 text-right">
                   
                     <div class="txt1">Registered Users
                     </div>
                       <div class="huge">
                     <?php
	$sql = "SELECT * from tbl_user";
	if ($tbl_user = mysqli_query($con, $sql)) {
	$rowcount = mysqli_num_rows( $tbl_user );
	printf(" %d\n", $rowcount);
}
?>
</div>
                  </div>
               </div>
            </div>
            
               
            
         </div>
         
      </div></a>
      
    
    <a href="recharge_history.php">  
      <div class="col-lg-3 col-md-6">
         <div class="panel panel-green">
            <div class="panel-heading">
               <div class="row">
                  <div class="col-xs-3">
                     <!--<i class="fa fa-inr fa-3x"></i>-->
                     <img class="ims" style="width:73px;" src="dist/img/recharge_request.png">
                  </div>
                  <div class="col-xs-9 text-right">
                   
                     <div class="txt1">Recharge Request</div>
                       <div class="huge">
                     <?php
	$sql = "SELECT * from `tbl_walletsummery` where `actiontype`='recharge' and status=0";
	$tbl_rechrage = mysqli_query($con, $sql); 
        
     	 $rowcount12 = mysqli_num_rows( $tbl_rechrage );
     	 
     	  
         	printf(" %d\n", $rowcount12);

?>
</div>
                  </div>
               </div>
            </div>
            
              
            
         </div>
      </div></a>
      
     <a href="manage_withdraw.php">  
      <div class="col-lg-3 col-md-6">
         <div class="panel panel-green">
            <div class="panel-heading">
               <div class="row">
                  <div class="col-xs-3">
                     <!--<i class="fa fa-credit-card fa-3x"></i>-->
                     <img class="ims" style="width:81px;" src="dist/img/withdrawal2.png">
                  </div>
                  <div class="col-xs-9 text-right">
                   
                     <div class="txt1">Withdrawal Request</div>
                       <div class="huge">
           <?php
      	   $sql = "SELECT * from `tbl_withdrawal` where status=1";
        	$tbl_withdrawal = mysqli_query($con, $sql); 
        
     	 $rowcount = mysqli_num_rows( $tbl_withdrawal );
     	 
     	  
         	printf(" %d\n", $rowcount);

?>
</div>
                  </div>
               </div>
            </div>
            
               
            
         </div>
      </div></a> 
      
       
      
       
      
     
     
      <a href="#">
    <div class="col-lg-3 col-md-6">
         <div class="panel panel-green">
            <div class="panel-heading">
               <div class="row">
                  <div class="col-xs-3">
                     <!--<i class="fa fa-inr fa-3x"></i>-->
                     <img class="ims" style="width: 78px;" src="dist/img/ttrecharge.png">
                  </div>
                  <div class="col-xs-9 text-right">
                   
                     <div class="txt1">Total Recharge</div>
                       <div class="huge">
                     <?php
	$sql = "SELECT * from `tbl_walletsummery` where `actiontype`='recharge' and `status`='1'";
	$tbl_rechrage12 = mysqli_query($con, $sql); 
        	$bb2 = 0;
     	 while( $rowcount122 = mysqli_fetch_array( $tbl_rechrage12 ))
     	 {
     	     $bb2 = $bb2 + $rowcount122['amount'];
     	 }
     	  
         	printf(" %d\n", $bb2);

?>
</div>
                  </div>
               </div>
            </div>
            
         </div>
      </div></a>
      
      <a href="#">
       <div class="col-lg-3 col-md-6">
         <div class="panel panel-green">
            <div class="panel-heading">
               <div class="row">
                  <div class="col-xs-3">
                     <!--<i class="fa fa-inr fa-3x"></i>-->
                     <img class="ims" src="dist/img/totalsuccesswithdraw.png">
                  </div>
                  <div class="col-xs-9 text-right">
                   
                     <div class="txt1">Total Withdraw</div>
                       <div class="huge">
                    <?php
      	   $sql = "SELECT * from `tbl_withdrawal` where `status`='0'";
        	$tbl_withdrawal123 = mysqli_query($con, $sql); 
        	$aa123 = 0;
     	 while( $rowcount123 = mysqli_fetch_array( $tbl_withdrawal123 ))
     	 {
     	     $aa123 = $aa123 + $rowcount123['amount'];
     	 }
     	  
         	printf(" %d\n", $aa123);

?>
</div>
                  </div>
               </div>
            </div>
            
         </div>
      </div></a>
      
      <a href="#">
         <div class="col-lg-3 col-md-6">
         <div class="panel panel-green">
            <div class="panel-heading">
               <div class="row">
                  <div class="col-xs-3">
                     <!--<i class="fa fa-inr fa-3x"></i>-->
                     <img class="ims" style="width: 67px;" src="dist/img/reward.png">
                  </div>
                  <div class="col-xs-9 text-right">
                   
                     <div class="txt1">Total Reward</div>
                       <div class="huge">
                    <?php
      	   $sqlreward = "SELECT * from `tbl_reward`";
        	$queryreward = mysqli_query($con, $sqlreward); 
        	$cc = 0;
     	 while( $rowcountreward = mysqli_fetch_array( $queryreward ))
     	 {
     	     $cc = $cc + $rowcountreward['amount'];
     	 }
     	  
         	printf(" %d\n", $cc);

?>
</div>
                  </div>
               </div>
            </div>
            
         </div>
      </div> </a>
      
     
      
       <a href="#">
         <div class="col-lg-3 col-md-6">
         <div class="panel panel-green">
            <div class="panel-heading">
               <div class="row">
                  <div class="col-xs-3">
                     <!--<i class="fa fa-inr fa-3x"></i>-->
                     <img class="ims"  src="dist/img/ttpromotion.png">
                  </div>
                  <div class="col-xs-9 text-right">
                   
                     <div class="txt1">Total Promotion</div>
                       <div class="huge">
                    <?php
      	   $sqlbonus = "SELECT * from `tbl_bonus`";
        	$querybonus = mysqli_query($con, $sqlbonus); 
        	$cccc = 0;
     	 while( $rowcountbunus = mysqli_fetch_array( $querybonus ))
     	 {
     	     $cccc = $cccc + $rowcountbunus['amount'];
     	 }
     	  
         	printf(" %d\n", $cccc);

?>
</div>

                  </div>
               </div>
            </div>
            
         </div>
      </div> </a>
      
      
      
      <a href="#">
      <div class="col-lg-3 col-md-6">
         <div class="panel panel-green">
            <div class="panel-heading">
               <div class="row">
                  <div class="col-xs-3">
                    <!-- <i class="fa fa-inr fa-3x"></i>-->
                    <img class="ims" style="width: 71px;" src="dist/img/walletbl.png">
                  </div>
                  <div class="col-xs-9 text-right">
                   
                     <div class="txt1">Wallet Balance</div>
                       <div class="huge">
                     <?php
       	$amount=0;              
    $sql_user = mysqli_query($con,"select * from tbl_user");
    while($query_data = mysqli_fetch_array($sql_user)){
    $user_id = $query_data['id'];
	$sql = mysqli_query($con,"select * from tbl_wallet where userid ='$user_id'");
    $rowcount = mysqli_fetch_array($sql);

	$amount=$amount+$rowcount['amount'];
	
    }
	printf(" %d\n",$amount);

?>
</div>
                  </div>
               </div>
            </div>
            
         </div>
      </div></a>
            
         </div>
      </div> 
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
  <?php include("include/footer.inc.php");?>
<script src="dist/js/pages/dashboard.js"></script>

</div>
<!-- ./wrapper -->


</body>
</html>
