Your IP : 3.141.192.174


Current Path : /home/lentoinv/covisclubinternational.com/profile/
Upload File :
Current File : //home/lentoinv/covisclubinternational.com/profile/searchuser.php

<?php
session_start(); ob_start();
include("lib/connect.inc.php");
if($uidx != 1){
    header("Location:../login.php");
}


if(isset($_POST['ShowStage'])){
    $_SESSION['stage']=$_POST['ShowStage'];
}

if(isset($_POST['ReleaseFund'])){
    $id=$_POST['ReleaseFund'];
$db->query("UPDATE user SET wallet=0 WHERE id='$id' ");
$report = 'Locked funds have been released for '.userName($id);
}


    //  $sql = $db->query("SELECT * FROM `user` WHERE level=1 AND email LIKE '%badaru%' ");
    //  while($row = mysqli_fetch_assoc($sql)){ $key=$row['sn'];
    //  $n=0;
    // $team = $covis->team1($key);
    // if($team>=12){ $db->query("UPDATE user SET level=2 WHERE sn='$key' ");  $n +=1;
    //  }
    //  $report=$n;
    // }

//      $sql = $db->query("SELECT * FROM `user` WHERE user='bbc' ");
// $row = mysqli_fetch_assoc($sql);
//      $report=$covis->userStageTeam($row['id']);
    
    
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Search User</title>
     <link rel="shortcut icon" href="img/fav.png" />
    <!-- Tell the browser to be responsive to screen width -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="treant/Treant.css">
    <link rel="stylesheet" href="treant/examples/tree/basic-example.css">
    <?php include('head.php'); ?>
</head>
<body class="hold-transition sidebar-mini layout-fixed">
<div class="wrapper">

    <?php include('nav.php'); ?>
     <div class="content-wrapper">
    <section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1>Search User</h1>
          </div>
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="index.php">Home</a></li>
              <li class="breadcrumb-item active">Search User</li>
            </ol>
          </div>
        </div>
      </div><!-- /.container-fluid -->
    </section> 

    <!-- Content Wrapper. Contains page content -->

    <!-- Content Header (Page header) -->
    <div class="content">
        <div class="container-fluid">
  <div class="row">
   <div class="col-md-12">
                <div class="card">
                    <div class="card-header text-white bg-dark">
                                    <h5 style="float: left">Find User</h5>

                                                            <form class="mt-3" method="post">
                                    <div class="float-right" style="margin-top: -20px"><table><tr><td><input type="text" name="q" required class="form-control" placeholder="Serach for"></td><td><select required name="filter" class="form-control">
                                                        <option value="">Select Option</option>
                                                        <option value="firstname">Firstname</option>
                                                        <option value="lastname">Lastname</option>
                                                        <option value="user">Username</option>
                                                        <option value="email">E-mail</option>
                                                        <option value="phone">Phone Number</option>
                                                    </select></td><td><button type="submit" name="Serach" class="btn btn-primary">Search Item</button></td><td></td></tr></table></div>
                                </form>
                                </div> 


                            
                            <div class="card-body">
                      
                                    
                                    <div class="overflow-x-auto">

                                     <table class="table table-bordered table-sm"  id="example1">
                                            <thead>
                                            <tr>
                                                <th>No</th>
                                                <th>Name(s)</th>
                                                <th>Email</th>
                                                <th>Username</th>
                                                <th>Joined On</th>
                                                <th>Action</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <?php
                                            $i=1;
                                            if(isset($_POST['q'])){
                                                $q = $_POST['q']; $filter = $_POST['filter'];
                                                $sql = $db->query("SELECT * FROM user WHERE $filter LIKE '%$q%' ");
                                            

                                            while($row = $sql->fetch_assoc()) { $e = $i++;

                                                ?>

                                                <tr>
                                                    <td><?php echo $e; ?></td>
                                                    <td><?php  echo $row['firstname'].' '.$row['lastname']    ?></td>
                                                    <td><?php echo $row['email'] ?></td>
                                                    <td><?php echo $row['user']; ?></td>
                                                    <td><?php echo substr($row['created'],0,10); ?></td>
                                                    <td><form method="post">
                                                        <button type="submit" value="<?php echo $row['id']; ?>" name="FindUser">Profile</button>
                                                    </form></td>
                                                </tr>

                                            <?php } } ?>
                                            </tbody>
                                            <tfoot>

                                            </tfoot>
                                        </table>
                                      
                                    </div>
                                </div>
                            </div>
                            </div>
                            </div><!-- /.card-header -->
                            <!-- /.card-body -->

                        <!-- /.card -->
                     
                <!-- /.row (main row) -->
                <?php
                

     if(isset($_SESSION['FindUser'])){ 
                $uid = isset($_SESSION['FindUser'])?$_SESSION['FindUser']:'';
                $uidx = $covis->idToKey($uid);
   if(isset($_GET['tree'])){$uidx = $_GET['tree']; $uid = $covis->keyToId($uidx); }
   
$stage = isset($_SESSION['stage'])?$_SESSION['stage']:$covis->stageCalc($uidx);
$st = $covis->stageCalc($uidx);
$covis->levelCreate($uidx); 
$level = userName($uid,'level');

 ?>
 <?php   
if(userName($uid,'team') != $covis->userStageTeam($uid)){$covis->updateUserStageTeam($uid);}  ?>
                <div class="row">
                <div class="col-md-12">
               <div class="card">
                   <div class="card-header text-white bg-dark">
                                    <h5>Geneology Matrix: <?php echo userName($uid) ?> </h5>
                                </div> 

               
                                    

                                    
                                        <div class="card-body">
                                            <h2 class=""><strong>STAGE: <?php echo $stage ?></strong></h2>

                                                <form method="post">
                                                    <?php $i = 1; while($i <=$st){ $e = $i++;?>
                                                        <button class="btn btn-sm btn-primary" name="ShowStage" value="<?php echo $e ?>">Stage <?php echo $e ?></button> <?php }  if(isset($_GET['tree'])){ ?>
                                                        <a class="btn btn-sm btn-danger" href="?">Reset</a>
                                                    <?php } ?>
                                                       <button class="btn btn-sm btn-primary" name="RecalculateUser" value="<?php echo $uidx ?>">Recalculate User Matrix</button>  
                                                </form>

                                            <div class="float-xs-right"><?php if($st==$stage){ ?>LEVEL: <?php echo $covis->stageLevel($uidx); } ?><br> STAGE TEAM: <?= $covis->stageTeam($uid,$stage) ?></div>
                                        </div>
                                        


                                           <div>
                                                <!--  Chart -->
                                                    <div class="chart" id="basic-example" style="width: 99%"></div>
                                            </div>
                                
                                </div>
                            </div>
                        </div>
                    </div>
  
    <section class="content">
      <div class="container-fluid">
  <div class="row">
          <div class="col-lg-3 col-12">
            <!-- small box -->
            <div class="small-box bg-info">
              <div class="inner">
                <h6 class="text-uppercase mb-1">Stage <?php echo $covis->stageCalc($uidx) ?></h6>
                    <h1 class="mb-1"><?php echo stageName($covis->stageCalc($uidx)) ?></h1>
                    <span class="text-white font-90">Level: <?php echo $covis->stageLevel($uidx) ?></span>
              </div>
              <div class="icon">
                <i class="ion ion-bag"></i>
              </div>
              <a href="#" class="small-box-footer">More info <i class="fas fa-arrow-circle-right"></i></a>
            </div>
          </div>
          <!-- ./col -->
          <div class="col-lg-3 col-12">
            <!-- small box -->
            <div class="small-box bg-success">
              <div class="inner">
               <h6 class="text-uppercase mb-1">Referral Bonus</h6>
                    <h1 class="mb-1">$<?php echo number_format($covis->referral($uidx),2) ?></h1>
                                        <span class="text-white font-90">Referrals: <?php echo $covis->referral($uidx) ?></span>
              </div>
              <div class="icon">
                <i class="ion ion-stats-bars"></i>
              </div>
              <a href="#" class="small-box-footer">More info <i class="fas fa-arrow-circle-right"></i></a>
            </div>
          </div>
          <!-- ./col -->
          <div class="col-lg-3 col-12">
            <!-- small box -->
            <div class="small-box bg-warning">
              <div class="inner">
                <h6 class="text-uppercase mb-1">Matrix Bonus</h6>
                    <h1 class="mb-1">$<?php echo number_format($covis->matrixBonus($uidx),2)  ?></h1>
                                        <span class=" text-white font-90">Total Earnings: $<?php echo number_format($covis->referral($uidx)+$covis->matrixBonus($uidx),2)  ?></span>
              </div>
              <div class="icon">
                <i class="ion ion-person-add"></i>
              </div>
              <a href="#" class="small-box-footer"><?php //echo $covis->stageTeam($uid,$stage); ?> More info <i class="fas fa-arrow-circle-right"></i></a>
            </div>
          </div>

          <div class="col-lg-3 col-12">
            <!-- small box -->
            <div class="small-box bg-secondary">
              <div class="inner">
               <h6 class="text-uppercase mb-1">Account Balance</h6>
                    <h1 class="mb-1">$<?php echo $covis->totalEarnings($uidx)<0 ? 0 : number_format($covis->totalEarnings($uidx),2)  ?>
                    <?php //echo $covis->score($uidx)  ?></h1>
                                        <span class=" text-white font-90">Withdrawals: $<?php echo number_format($covis->checkWithdraw($uidx),2) ?></span>
              </div>
              <div class="icon">
                <i class="ion ion-person-add"></i>
              </div>
              <a href="#" class="small-box-footer">$<?php echo number_format($covis->totalEarnings($uidx),2)  ?>  More info <i class="fas fa-arrow-circle-right"></i></a>
            </div>
          </div>
          <!-- ./col -->
          <div class="col-lg-3 col-12">
            <!-- small box -->
            <div class="small-box bg-danger">
              <div class="inner">
               <h6 class="text-uppercase mb-1">Received Transfer</h6>
                    <h1 class="mb-1">$<?php echo number_format(receivedTransfer($uid),2) ?></h1>
                                        <span class="text-white font-90">Funds Transfer: $<?php echo number_format(totalTransfer($uid),2) ?></span>
              </div>
              <div class="icon">
                <i class="ion ion-pie-graph"></i>
              </div>
              <a href="#" class="small-box-footer">More info <i class="fas fa-arrow-circle-right"></i></a>
            </div>
          </div>
          <!-- ./col -->

 <div class="col-lg-3 col-12">
            <!-- small box -->
            <div class="small-box bg-success">
              <div class="inner">
                <?php $mm = date('ym'); $tg=0; $level = userName($uid,'level'); $gress = sqL2('walletdist','id',$uidx,'mm',$mm);  $searn = colSum2('walletdist','amount','id',$uidx,'mm',date('ym'));  if($level==6){ $tg = sqLx('setup','sn',1,'d1'); }elseif($level==7){ $tg = sqLx('setup','sn',1,'d2'); }elseif($level>7){ $tg = sqLx('setup','sn',1,'d3'); } ?>
               <h6 class="text-uppercase mb-1">Structure Bonus</h6>
                    <h1 class="mb-1">$<?php echo $gress>=$tg ? number_format($searn,2) : '0.00' ?></h1>
                                        <span class="text-white font-90">Progress: <?= $gress.'/'.$tg ?> [$<?= number_format($searn,2) ?>]</span>
              </div>
              <div class="icon">
                <i class="ion ion-pie-graph"></i>
              </div>
              <a href="#" class="small-box-footer">Hit Stage 3 to Qualify</a>
            </div>
          </div> 

<?php if($stage==12){ ?>
          <div class="col-lg-3 col-12">
            <!-- small box -->
            <div class="small-box bg-primary">
              <div class="inner">
               <h6 class="text-uppercase mb-1">Mega Car Promo</h6>
                    <h1 class="mb-1"><?= count($covis->stageTeamPromo($uid)) ?>/18</h1>
                                        <span class="text-white font-90">Aug 1, 2021 - Sept 30, 2021</span>
              </div>
              <div class="icon">
                <i class="ion ion-pie-graph"></i>
              </div>
              <a href="#" class="small-box-footer">Produce 12 New Stage 3 Accounts</a>
            </div>
          </div>
           <?php  }   ?>

                                <!-- ./col -->
          <div class="col-lg-3 col-12">
            <!-- small box -->
            <div class="small-box bg-info">
              <div class="inner">
               <h6 class="text-uppercase mb-1">REAL ESTATE TRADING</h6>
                    <h1 class="mb-1">$<?php echo number_format(colSum2('withdraw','amount','id',$uid,'type','relox property purchase',2),2) ?></h1>
                                        <span class="text-white font-90">Broker Commission: $<?php echo number_format(colSum2('transfer','amount','id2',$uid,'type','sc',2),2) ?></span>
              </div>
              <div class="icon">
                <i class="ion ion-pie-graph"></i>
              </div>
              <a href="#" class="small-box-footer">More info <i class="fas fa-arrow-circle-right"></i></a>
            </div>
          </div>
           
        </div>
        <!-- /.row -->


         <div class="row">
                <div class="col-md-12">
               <div class="card">
                   <div class="card-header text-white bg-dark">
                                    <h5>Account Summary</h5>
                                </div> 
                             <div class="card-body">
                              <?php $stage=$covis->stageCalc($uidx); ?>
                                 <table class="table table-bordered table-sm" id="example3">
                                        <tr>
                                           <th>Transaction</th>
                                            <th>Credit</th>
                                            <th>Debit</th>
                                           
                                            <th>Balance</th>
                                          
                                        </tr>
                                     
                                            <tr>
                                                <td>Stage 1 Step Out Bonus</th>
                                                <td>$<?php $credit = 0; echo $credit  ?></th>
                                                <td></th>
                                                <td>$<?php echo $credit  ?></th>
                                            </tr>
                                            <tr>
                                                <td>Referral Bonus</th>
                                                <td>$<?php  echo number_format($covis->referral($uidx),2)  ?></th>
                                                <td></th>
                                                <td>$<?php $credit += $covis->referral($uidx); echo number_format($credit,2)  ?></th>
                                            </tr>
                                              <tr>
                                                <td>Matrix Bonus</th>
                                                <td>$<?php $matbonus = $covis->getUserLevelePayout($uid);  echo number_format($matbonus,2)  ?></th>
                                                <td></th>
                                                <td>$<?php $credit += $matbonus; echo number_format($credit,2)  ?></th>
                                            </tr>


                                            <tr>
                                                <td>Locked Funds <?php if(userName($uid,'wallet') != 0){ ?>   <form method="post">
                                                        <button type="submit" value="<?php echo $uid; ?>" name="ReleaseFund">Release Funds</button>
                                                    </form>
                                                <?php } ?>
                                                </th><td></th>
                                                <td>$<?php $wa = userName($uid,'wallet'); echo $wa  ?></th>
                                                
                                                <td>$<?php $credit -= $wa; echo number_format($credit,2)  ?></th>
                                            </tr>
<tr>
                                                <td>Received Funds</th>
                                                <td>$<?php $received = receivedTransfer($uid);  echo number_format($received,2)  ?></th>
                                                <td></th>
                                                <td>$<?php $credit += $received; echo number_format($credit,2)  ?></th>
                                            </tr>
                                            <tr>
                                                <td>Withdrawals</th>
                                                <td></th>
                                                <td>$<?php  echo number_format($covis->checkWithdraw($uidx),2)  ?></th>
                                                <td>$<?php $credit -= $covis->checkWithdraw($uidx); echo number_format($credit,2)  ?></th>
                                            </tr>
                                        
                                            <tr>
                                                <td>Transfered Funds</th>
                                                <td></th>
                                                <td>$<?php $transfer=totalTransfer($uid);  echo number_format($transfer,2)  ?></th>
                                                <td>$<?php $credit -= $transfer; echo number_format($credit,2)  ?></th>
                                            </tr>
                                            <tr>
                                                <td>Topup Services</th>
                                                <td></th>
                                                <td>$<?php $topup = $covis->myTopups($uidx);;  echo number_format($topup,2)  ?></th>
                                                <td>$<?php $credit -= $topup; echo number_format($credit,2)  ?></th>
                                            </tr>
                                            <tr>
                                                <td>OnePayNg</th>
                                                <td>$<?php $onepayplus = $covis->onePayPlus($uid);  echo number_format(abs($onepayplus),2)  ?></th>
                                                <td>$<?php $onepay = $covis->onePayDebit($uid);  echo number_format(abs($covis->onePayMinus($uid)),2)  ?></th>
                                                <td>$<?php $credit -= $onepay; echo number_format($credit,2)  ?></th>
                                            </tr>
                                        
                                    </table>
                             </div>
                         </div>
                     </div>
                 </div>




                                      <div class="row">
                <div class="col-md-12">
               <div class="card">
                   <div class="card-header text-white bg-dark">
                                    <h5>Upline Information: <?php echo userName($uid,'user') ?></h5>
                                </div> 

               
                                    

                                    
                                        <div class="card-body">

                                     
                                        <?php $userid=$uid; $sponsor = userName($userid,'sponsor');  ?>
                                        <div class="row">
                                             <div class="col-md-2">
                                                <label for="name"><b>Sponsor:</b> </label>
                                            <h6><?php echo ucwords(snToName($sponsor)).'<br> ('.snToName($sponsor,'user').')' ?></h6>
                                            <hr/>
                                            </div>
                                            <?php  function snToUpline($a,$opt='a1'){
                                              global $db;
                           $que = $db->query("SELECT * FROM user WHERE sn = '$a' ") or die(mysqli_error());
                           $ro = mysqli_fetch_array($que);
                          return $ro[$opt];
                                            }

                                              $ax = $uidx;
                                             $end = isset($_GET['more'])?100:20;
                                             for($i=1;$i<=$end;$i++){ $a = 'a'.$i;
                                              $ax = snToUpline($ax);
                                                if($ax == 0){continue;}
                                                else { $su = $_GET['up']??'';
                                                   $col = $su==snToName($ax,'user')?'style="color:red"':'';
                                             ?>
                                            <div class="col-md-2">
                                                <label for="name"><b>Upline <?php echo $i ?>:</b> </label>
                                            <h6><?php echo ucwords(snToName($ax)).'<br><b '.$col.'>'.snToName($ax,'user').'</b>' ?></h6>
                                            <hr/>
                                            </div>
                                        <?php  } } ?>
                                        </div>
                                           <form method="get">
                                             <input type="text" name="up" placeholder="Upline username">
                                             <button type="submit" value="true" name="more">Find Upline Position</button>
                                           </form>
                                        </div>
<!-- 
                                        <a href="?more=true">Load more</a> -->
                                    </div>
                                </div>
                            </div>
                        

                                      <div class="row">
                <div class="col-md-12">
               <div class="card">
                   <div class="card-header text-white bg-dark">
                                    <h5>Profile Data </h5>
                                </div> 
                             <div class="card-body">
                                 <div class="row">
                                    <div class="col-md-6">
                                        <label for="name">First Name: </label>
                                        <h6><?php echo ucwords(userName($userid,'firstname')) ?></h6>
                                        <hr/>
                                    </div>
                                    <div class="col-md-6">
                                        <label for="name">Last Name: </label>
                                        <h6><?php echo ucwords(userName($userid,'lastname')) ?></h6>
                                        <hr/>
                                    </div>
                                    <div class="col-md-6">
                                        <label for="name">User Name: </label>
                                        <h6><?php echo ucwords(userName($userid,'user')) ?></h6>
                                        <hr/>
                                    </div>
                                    <div class="col-md-6">
                                        <label for="name">Email: </label>
                                        <h6><?php echo userName($userid,'email') ?></h6>
                                        <hr/>
                                    </div>
                                    <div class="col-md-6">
                                        <label for="name">Phone Number: </label>
                                        <h6><?php echo userName($userid,'phone') ?></h6>
                                        <hr/>
                                    </div>
                                    <div class="col-md-6">
                                        <label for="name">Residential Address: </label>
                                        <h6><?php echo ucwords(userName($userid,'address')) ?></h6>
                                        <hr/>
                                    </div>
                                    <div class="col-md-6">
                                        <label for="name">Sex: </label>
                                        <h6><?php echo ucwords(userName($userid,'sex')) ?></h6>
                                        <hr/>
                                    </div>
                                    <div class="col-md-6">
                                        <label for="name">Date Of Birth: </label>
                                        <h6><?php echo userName($userid,'dob') ?></h6>
                                        <hr/>
                                    </div>
                                    <div class="col-md-6">
                                        <label for="name">Office Address: </label>
                                        <h6><?php echo ucwords(userName($userid,'officeaddress')) ?></h6>
                                        <hr/>
                                    </div>
                                    <div class="col-md-6">
                                        <label for="name">City: </label>
                                        <h6><?php echo ucwords(userName($userid,'city')) ?></h6>
                                        <hr/>
                                    </div>
                                    <div class="col-md-6">
                                        <label for="name">State: </label>
                                        <h6><?php echo ucwords(userName($userid,'state')) ?></h6>
                                        <hr/>
                                    </div>
                                    <div class="col-md-6">
                                        <label for="name">Bank: </label>
                                        <h6><?php echo ucwords(userName($userid,'bank')) ?></h6>
                                        <hr/>
                                    </div>
                                    <div class="col-md-6">
                                        <label for="name">Account No: </label>
                                        <h6><?php echo userName($userid,'accountno') ?></h6>
                                        <hr/>
                                    </div>
                                    <div class="col-md-6">
                                        <label for="name">Serial Number: </label>
                                        <h6><?php echo userName($userid,'sno') ?></h6>
                                        <hr/>
                                    </div>

                                     <div class="col-md-12">
                                        <div class="float-md-right">
                                          <form method="post">
                                              <?php if(userName($userid,'status')==1){ ?>
                                    
                                    <button type="submit" class="btn btn-danger" value="<?php echo $uid ?>" name="SuspendAccount">SUSPEND ACCOUNT: <?php echo userName($uid) ?></button>
<?php } else{ ?> 
 <button type="submit" class="btn btn-info" value="<?php echo $uid ?>" name="UnSuspendAccount">RESTORE ACCOUNT: <?php echo userName($uid) ?></button>

<?php } ?>

<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#uploadpicture">Upload New Photo</button>


                                            <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#editprofile">Edit Profile</button>
                                     </form>   </div>

                                     
                                    </div>

                                </div>

                                        </div>
                                    </div>
                                </div>
                            </div>


                                      <div class="row">
                <div class="col-md-12">
               <div class="card">
                   <div class="card-header text-white bg-dark">
                                    <h5>Withdrawal History</h5>
                                </div> 
                             <div class="card-body">
                                 <table class="table table-bordered table-sm" id="example3">
                                        <tr>
                                            <th>S/N</th>
                                            <th>Transaction ID</th>
                                            <th>Amount($)</th>
                                           
                                            <th>Transation Status</th>
                                            <th>Remark</th>
                                            <th>Transation Date</th>
                                        </tr>
                                        <?php $sql = $db->query("SELECT * FROM withdraw WHERE id='$uid' ORDER BY sn DESC"); $i = 0; $sum = 0;
                                        while($row = $sql->fetch_assoc()){ $i +=1; $sum += $row['amount'];
                                            $status = ($row['status']==0)?'Pending':'Approved';
                                           
                                            ?>
                                            <tr>
                                                <td><?php echo $i  ?></th>
                                                <td><?php echo $row['tno']  ?></th>
                                               
                                                <td>$<?php echo $row['amount']  ?></th>
                                                <td><?php echo $status  ?></th>
                                                <td><?php echo $covis->withdrawRemark($row['type'])  ?></th>
                                                <td><?php echo date("jS M, Y H:i",strtotime($row['created']))  ?></th>
                                            </tr>
                                        <?php } ?>
                                         <tr>
                                            <th colspan="2">TOTAL</th>
                                      
                                            <th colspan="4">$<?php echo number_format($sum,2) ?></th>
                                        </tr>
                                        
                                    </table>
                             </div>
                         </div>
                     </div>
                 </div>




                  <div class="row">
                <div class="col-md-12">
               <div class="card">
                   <div class="card-header text-white bg-dark">
                                    <h5>Fund Transfer/Received History</h5>
                                </div> 
                             <div class="card-body">
                                 <table class="table table-bordered table-hover table-sm" id="example2">
                                        <tr>
                                            <th>S/N</th>
                                            <th>Transaction ID</th>
                                            <th>Transfer($)</th>
                                            <th>Received($)</th>
                                            <th>Recipient(s)</th>
                                            <th>Status</th>
                                            <th>Date</th>
                                        </tr>
                                        <?php $sql = $db->query("SELECT * FROM transfer WHERE id='$uid' OR id2='$uid' ORDER BY created DESC"); $i = 0; $sum = 0; $sum2 = 0;
                                        while($row = $sql->fetch_assoc()){ $i +=1; $sum += $uid==$row['id'] ? $row['amount'] : 0;
                                        $sum2 += $uid==$row['id2'] ? $row['amount'] : 0;
                                            $status = ($row['status']==0)?'Pending':'Approved';
                                            ?>
                                            <tr>
                                                <th><?php echo $i  ?></th>
                                                <th><?php echo $row['tno']  ?></th>
                                            <th><?php echo $uid==$row['id'] ? '$'.$row['amount'] : ''; ?></th>
                                          <th><?php echo $uid==$row['id2'] ? '$'.$row['amount'] : ''; ?></th>
                                                
                                                <th><?php echo userName($row['id2'],'user')  ?></th>
                                                <th>Successful</th>
                                                <th><?php echo date("jS M, Y H:i",strtotime($row['created']))  ?></th>
                                            </tr>
                                        <?php } ?>
                                        <tr>
                                            <th colspan="2">TOTAL</th>
                                            <th colspan="">$<?php echo number_format($sum,2) ?></th>
                                            <th colspan="4">$<?php echo number_format($sum2,2) ?></th>
                                        </tr>
                                    </table>
                             </div>


                             <div class="card-header text-white bg-dark">
                                    <h5 style="float: left;">Recent OnePayNg Transactions History</h5>
                                  
                                    </div>
                                 
                                    <div class="card-body">
                                          <table class="table table-striped table-bordered dataTable" id="example1">
                                        <tr>
                                            <th>S/N</th>
                                            <th>User</th>
                                            <th>Date</th>
                                            <th>Amount($)</th>
                                            <th>Remark</th>
                                           
                                        </tr>
                                        <?php $sql = $db->query("SELECT * FROM onepaydebit WHERE userid='$uid' ORDER BY id DESC LIMIT 100"); $i = 0;
                                        while($row = mysqli_fetch_assoc($sql)){ $i +=1;
                                            $col = $row['channel']<3 ? 'style="color: red"' : '';
                                            ?>
                                            <tr <?php echo $col ?>>
                                                <td><?php echo $i  ?></th>
                                                <td><?php echo userName($row['userid'])  ?> (<?php echo userName($row['userid'],'user')  ?>)</th>
                                                <td><?php echo date('jS M Y',strtotime($row['date']))  ?></th>
                                                <td>$<?php echo number_format(abs($row['price']/$covis->onePayRate),2)  ?></th>
                                                <td> <?php echo $covis->onePayRemark($row['channel']);  ?></th>
                                               
                                            </tr>
                                        <?php } ?>
                                       
                                    </table>
                                    </div>
                              
                         </div>
                     </div>
                 </div>




                        </div>
    </div>
</section>

              <?php } ?>          <!-- /.tab-content -->
                    </div><!-- /.card-body -->
            </div>
            <!-- /.nav-tabs-custom -->
    </div>
    <!-- /.col -->


<!-- /.content-wrapper -->
<?php include('foot.php'); ?>

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



<form method="post">
    <div class="modal animated bounceInUp small-modal" id="editprofile" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                   <h5 class="modal-title" id="mySmallModalLabel">Edit Profile</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">×</span>
                    </button>
                    
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-md-2">First Name: </div>
                        <div class="col-md-10 form-group">
                            <input type="text" class="form-control" name="firstname" value="<?php echo userName($uid,'firstname')  ?>" placeholder="First Name"/>
                        </div>
                        <div class="col-md-2">Last Name: </div>
                        <div class="col-md-10 form-group">
                            <input type="text" class="form-control" name="lastname" value="<?php echo userName($uid,'lastname') ?>" placeholder="Last Name"/>
                        </div>
                        <div class="col-md-2">User Name: </div>
                        <div class="col-md-10 form-group">
                            <input type="text" class="form-control" name="username" value="<?php echo userName($uid,'user') ?>" placeholder="Last Name"/>
                        </div>
                        <div class="col-md-2">Email: </div>
                        <div class="col-md-10 form-group">
                            <input type="email" class="form-control" name="email" value="<?php echo userName($uid,'email') ?>" placeholder="Email"/>
                        </div>
                        <div class="col-md-2">Residential Address: </div>
                        <div class="col-md-10 form-group">
                            <input type="text" class="form-control" name="address" value="<?php echo userName($uid,'address') ?>" placeholder="Residential Address"/>
                        </div>
                        <div class="col-md-2">Phone Number: </div>
                        <div class="col-md-10 form-group">
                            <input type="number" class="form-control" name="phone" value="<?php echo userName($uid,'phone') ?>" placeholder="Phone Number"/>
                        </div>
                        <div class="col-md-2">Sex: </div>
                        <div class="col-md-10 form-group">
                            <?php  $selected = (userName($uid,'sex') == 'm')?'selected':''; ?>
                            <?php  $selected2 = (userName($uid,'sex') == 'f')?'selected':''; ?>
                            <select name="sex" class="form-control">
                                <option value="Male" <?php echo $selected ?> >Male</option>
                                <option value="Female" <?php echo $selected2 ?> >Female</option>
                            </select>
                        </div>
                        <div class="col-md-2">Date OF Birth: </div>
                        <div class="col-md-10 form-group">
                            <input type="date" class="form-control" name="dob" value="<?php echo userName($uid,'dob') ?>" placeholder="Date Of Birth"/>
                        </div>
                        <div class="col-md-2">Office Address: </div>
                        <div class="col-md-10 form-group">
                            <input type="text" class="form-control" name="officeaddress" value="<?php echo userName($uid,'officeaddress') ?>" placeholder="Office Address"/>
                        </div>
                        <div class="col-md-2">City: </div>
                        <div class="col-md-10 form-group">
                            <input type="text" class="form-control" name="city" value="<?php echo userName($uid,'city') ?>" placeholder="City"/>
                        </div>
                        <div class="col-md-2">State: </div>
                        <div class="col-md-10 form-group">
                            <select name="state" class="form-control">
                                <option value="<?php echo userName($uid,'state') ?>" selected><?php echo userName($uid,'state') ?></option>
                                <option>
                                    Abia</option><option>
                                    Adamawa</option><option>
                                    Akwa</option><option>
                                    Anambra</option><option>
                                    Bauchi</option><option>
                                    Bayelsa</option><option>
                                    Benue</option><option>
                                    Borno</option><option>
                                    Cross River</option><option>
                                    Delta</option><option>
                                    Ebonyi</option><option>
                                    Edo</option><option>
                                    Ekiti</option><option>
                                    Enugu</option><option>
                                    FCT</option><option>
                                    Gombe</option><option>
                                    Imo</option><option>
                                    Jigawa</option><option>
                                    Kaduna</option><option>
                                    Kano</option><option>
                                    Katsina</option><option>
                                    Kebbi</option><option>
                                    Kogi</option><option>
                                    Kwara</option><option>
                                    Lagos</option><option>
                                    Nasarawa</option><option>
                                    Niger</option><option>
                                    Ogun</option><option>
                                    Ondo</option><option>
                                    Osun</option><option>
                                    Oyo</option><option>
                                    Plateau</option><option>
                                    Rivers</option><option>
                                    Sokoto</option><option>
                                    Taraba</option><option>
                                    Yobe</option><option>
                                    Zamfara</option><option>
                                    Non Nigerian</option>
                            </select>
                        </div>
                        <div class="col-md-2">Bank Name: </div>
                        <div class="col-md-10 form-group">
                            <input type="text" class="form-control" name="bank" value="<?php echo userName($uid,'bank') ?>" placeholder="Bank Name"/>
                        </div>
                        <div class="col-md-2">Account No: </div>
                        <div class="col-md-10 form-group">
                            <input type="text" class="form-control" name="accountno" value="<?php echo userName($uid,'accountno') ?>" placeholder="Account Number"/>
                        </div>
                        <input type="hidden" name="id" value="<?php echo $uid ?>"/>
                    </div>
                </div>
                <div class="modal-footer">

                    <button type="submit" class="btn btn-primary" name="EditProfileAdmin">Edit Profile</button>
                    <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
                </div>
            </div>
        </div>
    </div>
</form>


                <?php
$image = (userName($uid,'photo')=='')?'user.png':userName($uid,'photo');   ?>
<form method="post" enctype="multipart/form-data">
    <div class="modal animated bounceInUp small-modal" id="uploadpicture" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                   <h5 class="modal-title" id="mySmallModalLabel">Upload Picture: <?php echo userName($uid) ?></h5>
                    
                     <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">×</span>
                    </button>
                    
                </div>
                <div class="modal-body">
                    <input type="hidden" name="firstname" value="<?php echo userName($uid,'firstname')  ?>"/>
                    <input type="file" name="photo" id="input-file-now-custom-1" class="dropify" data-default-file="images/<?php echo $image ?>" />
                </div>
                <input type="hidden" name="id" value="<?php echo $uid ?>"/>
                <div class="modal-footer">

                    <button type="submit" class="btn btn-primary" name="UploadPicture">Upload Picture</button>
                    <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
                </div>
            </div>
        </div>
    </div>
</form>


<!-- jQuery -->
<script src="../plugins/jquery/jquery.min.js"></script>
<!-- jQuery UI 1.11.4 -->
<script src="../plugins/jquery-ui/jquery-ui.min.js"></script>
<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
<script>
    $.widget.bridge('uibutton', $.ui.button)
</script>
<!-- Bootstrap 4 -->
<script src="../plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="../plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js"></script>
<!-- Summernote -->
<script src="../plugins/summernote/summernote-bs4.min.js"></script>
<!-- overlayScrollbars -->
<script src="../plugins/overlayScrollbars/js/jquery.overlayScrollbars.min.js"></script>
<!-- AdminLTE App -->
<script src="../dist/js/adminlte.js"></script>
<!-- AdminLTE dashboard demo (This is only for demo purposes) -->
<script src="../dist/js/pages/dashboard.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="../dist/js/demo.js"></script>
<!-- DataTables -->

<!-- page script -->
<script type="text/javascript">
<?php if($stage==1){ echo $covis->covisTree($uid);  }elseif($stage==2){ echo $covis->covisTreeS2($uid);  } else {echo $covis->covisTree4($uid);} ?>
</script>

<script src="treant/vendor/raphael.js"></script>
<script src="treant/Treant.js"></script>


<script>
    new Treant( chart_config );
</script>
<!-- DataTables -->
<script src="../plugins/datatables/jquery.dataTables.min.js"></script>
<script src="../plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
<script src="../plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
<script src="../plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>


<!-- page script -->
<script>
    $(function () {
        $("#example1").DataTable({
            "responsive": true,
            "autoWidth": false,
        });
        $("#example3").DataTable({
            "responsive": true,
            "autoWidth": true,
            "responsive": true,
        });
        $('#example2').DataTable({
            "paging": true,
            "lengthChange": false,
            "searching": false,
            "ordering": true,
            "info": true,
            "autoWidth": false,
            "responsive": true,
        });
    });
</script>
</body>
</html>

?>