Your IP : 216.73.216.26


Current Path : /home2/wtmwscom/www/member/
Upload File :
Current File : /home2/wtmwscom/www/member/downline_level.php

<?php 
$title= "Total Downline";
include 'header.php';
//include_once('lib/ps_pagination.php');
$uid = $_SESSION['userid'];
$result1 = mysqli_query($connection, "SELECT uid, login_id,  name, reg_date, mobile, position, type, status, plan_type, is_paid, topup_datetime FROM user WHERE placement_id = '$uid'");

?>
    <h1>Downline Level Team</h1>
    <section>
        <?php echo getMessage();?>
    <section>
        <table class="table table-bordered table-responsive">
          <thead>
            <tr>
              <th>Left Team</th>
              <th>Right Team</th>
            </tr>
          </thead>
          <tbody>
              <?php if(mysqli_num_rows($result1)) {
                  $left_id_array = array();
                  $right_id_array = array();
     while ($row1 = mysqli_fetch_object($result1)) {
         if($row1->position == "L"){
             $left_id_array['uid'] = $row1->uid;
             $left_id_array['name'] = $row1->name;
             $left_id_array['login_id'] = $row1->login_id;
             $left_id_array['is_paid'] = $row1->is_paid;
             $left_id_array['topup_date'] = !empty($row1->topup_datetime) ? date("d-m-Y H:i", strtotime($row1->topup_datetime)) : "";
         } else if($row1->position == "R"){
             $right_id_array['uid'] = $row1->uid;
             $right_id_array['name'] = $row1->name;
             $right_id_array['login_id'] = $row1->login_id;
             $right_id_array['is_paid'] = $row1->is_paid;
             $right_id_array['topup_date'] = !empty($row1->topup_datetime) ? date("d-m-Y H:i", strtotime($row1->topup_datetime)) : "";
         }
     }
                  ?>
              <tr>
                  <td style="width: 50%">
              <table class="table table-hover table-striped table-responsive">
          <thead>
            <tr>
              <th>Sno.</th>
              <th>Team members</th>
            </tr>
          </thead>
          <tbody>
              <?php
              if(!empty($left_id_array['uid'])) { ?>
              <tr>
                  <td >1.</td>
                  <td>
               <?php   $class = $left_id_array['is_paid'] == 1 ? "alert-success" : "alert-danger";
            echo $left_id_array['name'] ." (<b class='$class'>".$left_id_array['login_id']."</b>) ".$left_id_array['topup_date'].", "; 
            ?>
              </td>
              </tr>
         <?php   $level = array(array($uid));
    $result = mysqli_query($connection, "select uid, login_id,  name, reg_date, position, type, status, plan_type, is_paid, topup_datetime from user where placement_id = '".$left_id_array['uid']."' ORDER BY position ASC ");
    if (mysqli_num_rows($result) != 0) {
        $i = 2;
        ?>
              <tr>
                  <td ><?php echo $i; ?></td>
                  <td>
        <?php while ($row = mysqli_fetch_object($result)) {
            $level[$i][] = $row->uid;
            $class = $row->is_paid == 1 ? "alert-success" : "alert-danger";
            echo " $row->name (<b class='$class'>$row->login_id</b>) ";
            echo !empty($row->reg_date)  ? date("d-m-Y", strtotime($row->reg_date)): "";
            echo  ", ";
             } ?>
               </td>
              </tr>
       <?php  while (TRUE) {
           ?>
              <tr>
                  <td><?php echo $i+1; ?></td>
                  <td>
           <?php foreach ($level[$i] as $value) {
                $result = mysqli_query($connection, "select uid, login_id,  name, reg_date, position, type, status, plan_type, is_paid, topup_datetime from user where placement_id = '$value' ORDER BY position ASC ");
                //if(mysqli_num_rows($result) != 0){
                while ($row = mysqli_fetch_object($result)) {
                    $level[$i + 1][] = $row->uid;
                    $class = $row->is_paid == 1 ? "alert-success" : "alert-danger";
            echo " $row->name (<b class='$class'>$row->login_id</b>) ";
            echo !empty($row->reg_date)  ? date("d-m-Y", strtotime($row->reg_date)): "";
            echo  ", ";
                } ?>
                
             <?php } ?>
               </td>
              </tr>
       <?php
            // if($i==4){break;}
            if (!empty($level[$i + 1])) {
                $i++;
                continue;
            } else {
                //return $level;
                break;
            }
        }
    }
              }
              ?>
              
          </tbody>
              </table>
          </td>
          <td style="width: 50%">
          <table class="table table-hover table-striped table-responsive">
          <thead>
            <tr>
              <th>Sno.</th>
              <th>Team members</th>
            </tr>
          </thead>
          <tbody>
              <?php
              if(!empty($right_id_array['uid'])) { ?>
              <tr>
                  <td >1.</td>
                  <td>
               <?php   $class = $right_id_array['is_paid'] == 1 ? "alert-success" : "alert-danger";
            echo $right_id_array['name'] ." (<b class='$class'>".$right_id_array['login_id']."</b>) ".$right_id_array['topup_date'].", "; 
            ?>
              </td>
              </tr>
         <?php   $level = array(array($uid));
    $result = mysqli_query($connection, "select uid, login_id,  name, reg_date, position, type, status, plan_type, is_paid, topup_datetime from user where placement_id = '".$right_id_array['uid']."' ORDER BY position ASC ");
    if (mysqli_num_rows($result) != 0) {
        $i = 2;
        ?>
              <tr>
                  <td ><?php echo $i; ?></td>
                  <td>
        <?php while ($row = mysqli_fetch_object($result)) {
            $level[$i][] = $row->uid;
            $class = $row->is_paid == 1 ? "alert-success" : "alert-danger";
            echo " $row->name (<b class='$class'>$row->login_id</b>) ";
            echo !empty($row->reg_date)  ? date("d-m-Y", strtotime($row->reg_date)): "";
            echo  ", ";
             } ?>
               </td>
              </tr>
       <?php  while (TRUE) {
           ?>
              <tr>
                  <td><?php echo $i+1; ?></td>
                  <td>
           <?php foreach ($level[$i] as $value) {
                $result = mysqli_query($connection, "select uid, login_id,  name, reg_date, position, type, status, plan_type, is_paid, topup_datetime from user where placement_id = '$value' ORDER BY position ASC ");
                //if(mysqli_num_rows($result) != 0){
                while ($row = mysqli_fetch_object($result)) {
                    $level[$i + 1][] = $row->uid;
                    $class = $row->is_paid == 1 ? "alert-success" : "alert-danger";
            echo " $row->name (<b class='$class'>$row->login_id</b>) ";
            echo !empty($row->reg_date)  ? date("d-m-Y", strtotime($row->reg_date)): "";
            echo  ", ";
                } ?>
                
             <?php } ?>
               </td>
              </tr>
       <?php
            // if($i==4){break;}
            if (!empty($level[$i + 1])) {
                $i++;
                continue;
            } else {
                //return $level;
                break;
            }
        }
    }
              }
              ?>
              
          </tbody>
              </table>
            </td>
              
         </tr>
              <?php } ?>
          </tbody>
        </table>
    </section>
<?php include 'footer.php';?>