								<div class="card">
                                    <?php 
                                    $limit =500;
                                    $offset = RMC($_GET['m']);
                                    if($offset<1){
                                        $offset = 0;
                                        $num = 1;
                                    }else{
                                        $num=$offset+1;
                                    }
									
									//echo $i_url;
 									if(strpos($i_url, 'users/') !== false){
										//count all
										$sql4="SELECT * from j_users WHERE j_deleted < 1 AND j_status < 1 order by j_id desc";  
										$result4 = runSQL($sql4);
										$total = mysqli_num_rows($result4);
								
  										$sql4="SELECT * from j_users WHERE j_deleted < 1 AND j_status < 1 order by j_id desc limit $limit offset $offset"; //check 
										$result4 = runSQL($sql4);
										$count = mysqli_num_rows($result4); 
                                        //
                                        $sql44="SELECT j_referrer_id, count(j_referrer_id) as sum from j_users WHERE 
                                        j_referrer_id !='' AND j_deleted < 1 
                                        group by j_referrer_id order by sum desc limit 10"; 
                                        $result4x = runSQL($sql44);
                                        $highest_referrals = mysqli_num_rows($result4x);
                  
									}


									
 
                                    
                                    if($count>0){
                                        
                                    $sql44="SELECT DISTINCT j_user_id from j_pays WHERE 
                                     j_paid > 0 AND j_deleted < 1
                                     order by j_id desc"; //check 
                                    $result44 = runSQL($sql44);
                                    $total_activated = mysqli_num_rows($result44);
                                    //if($highest_referrals>0){
                                    ?>
                                       
                                                    
                                    <div class="card-body">
                                        <p>
                                            Count: <?php echo number_format($total); ?> <br/>
                                            <?php 
											/*
											Users that have transacted: <?php echo number_format($total_activated); ?> <br/>
                                            users that have not transacted: <?php echo number_format($total-$total_activated); ?> <br/>
											*/
											?>
                                        </p>
										<?php if(strpos($i_url, 'users/') !== false){ ?>
                                        <p>
                                            <a href="<?php echo $dir; ?>users/emails.php">Download Emails</a>
                                            <?PHP 
											/*
											&nbsp; &nbsp;
                                            <a href="<?php echo $dir; ?>users/download.php">Download Users Data (.xlx)</a>
											*/
											?>
											<?php 
											/*
                                            &nbsp; &nbsp;
                                            <a href="<?php echo $dir; ?>users/download-unpaid.php">Download Unpaid Users Data (.xlx)</a>
                                            &nbsp; &nbsp;
                                            <a href="<?php echo $dir; ?>users/download-paid.php">Download Paid Users Data (.xlx)</a>
											*/
											?>
                                        </p>
										<?php } ?>
										
										<?php 
										/*
                                         <div style="cursor:pointer; margin-bottom:10px;" id="searchAnything"> 
                                            <span class="badge badge-pill badge-primary font-size-12">Search Anything</span>
                                        </div>
                                        <div style="cursor:pointer;display:none; margin-bottom:10px;" id="hide_searchAnything"> 
                                            <span class="badge badge-pill badge-danger font-size-12">Hide Search</span>
                                        </div>

                                        <div id="my_saearch" style="display:none;">
                                             <form method="POST" action="" id="form" enctype="multipart/form-data">
                                                 <div class="form-row">
													<div class="form-group" style="display:none;">
                                                          <div class="input-affix m-b-2">
                                                             <input autocomplete="off" type="text" value="<?php echo $i_url; ?>" class="form-control rMe" name="url"/>
                                                         </div>
                                                    </div>
                                                    <div class="form-group col-md-6">
                                                          <div class="input-affix m-b-2">
                                                             <input autocomplete="off" type="text" placeholder="Search" class="form-control rMe" name="search"/>
                                                         </div>
                                                    </div>


                                                    <div class="form-group col-md-3">
                                                          <div class="input-affix m-b-2">
                                                                <button id="submit"  name="submit" class="btn btn-primary btn-block">Search</button>
                                                         </div>
                                                    </div>
                                                </div>
                                             </form>
                                            <div id="formresult"></div>
                                        </div>
										*/
										?>
                                        <!--table-responsive-->
                                         <div class="table-responsive m-t-10 my-content" id="my-content">
                                            <table id="datatable" class="table table-hover table-bordered">
                                                <thead>
                                                    <tr>
                                                        <th>S/N</th>
                                                          <th>Username</th>
                                                          <th>Name</th>
                                                         <th> Wallet</th>
                                                            <th>Email</th>
                                                            <th>Phone</th>
                                                            <th>Country</th>
                                                            <th>State</th>
                                                            <th>Local Govt. Area</th>
                                                            <th>House Address</th>
                                                            <th>Gender</th>
                                                           <th>Password</th>
                                                           <th>Referrer</th>
                                                           <th>Referrals</th>
                                                           
                                                         <th>Date</th>
                                                          <th>Menu </th>
                                                      </tr>
                                                </thead>
                                                <tbody>
                                                    <?php
                                                    while ($row = mysqli_fetch_array($result4)){
                                                    $cd = get_cd($row['j_currency']);
                                                    $currency_in_use = $cd[0];
                                                    $currency_code_in_use = $cd[1];
                                                    $currency_sort_in_use = $cd[2];
                                                        
                                                    //get referrer name and username
                                                    $sql2 = "SELECT * FROM j_users where j_id='".$row['j_referrer_id']."'";
                                                    $result2 = runSQL($sql2);
                                                    $data2 = mysqli_fetch_array($result2);
                                                    $r_firstname = $data2['j_firstname'];
                                                    $r_lastname = $data2['j_lastname'];
                                                    $r_username = $data2['j_username'];
                                                    $r_name = trim("$r_firstname $r_lastname");
                                                    //count number of users referred
                                                     $sql44="SELECT j_referrer_id from j_users WHERE 
                                                     j_referrer_id='".$row['j_id']."' AND j_deleted < 1 
                                                     order by j_id desc"; //check 
                                                    $result44 = runSQL($sql44);
                                                    $total_ref = mysqli_num_rows($result44);
                                                    //check if user has activated basic
                                                    $sql41="SELECT * from j_pays WHERE j_user_id='".$row['j_id']."' AND j_paid > 0 AND j_deleted < 1 order by j_id desc";  
                                                    $result41 = runSQL($sql41);
                                                    $check = mysqli_num_rows($result41);
                                                    $check_activate = $check; 
                                                    //
                                                    
                                                    if($check_activate > 0){
                                                        $pay_status = "<b style='color:green;'>Paid</b>";
                                                    }else{
                                                        $pay_status = "<b style='color:red;'>Unpaid</b>";
                                                    }
                                                    //
                                                    $user_pass = base64_decode($row['j_password']);
                                                    $user_pass = str_replace($hash,'',$user_pass);
                                                    ?>
                                                     
                                                    <tr id="i<?php echo $row['j_id']; ?>">
														
                                                        
                                                        <td> <?php echo $num++; ?></td>
                                                         
                                                         <td> <?php echo $row['j_username']; ?></td>
                                                        <td> <?php echo $row['j_firstname']; echo ' '; echo $row['j_lastname'] ?>
                                                        <?php 
                                                            if($row['j_blocked']<1){ ?>
                                                            <i class="anticon anticon-check-o text-success"></i>
                                                            <?php }else{ ?>
                                                            <i class="anticon anticon-close-circle text-danger"></i>
                                                            <?php } ?>
                                                        </td>
                                                        <td> <?php echo amount_w_c($row['j_wallet'],$currency_in_use); ?></td>
                                                         <td> <?php echo $row['j_email']; ?></td>
                                                         <td> <?php echo $row['j_phone']; ?></td>
                                                         <td> <?php echo $row['j_country']; ?></td>
                                                         <td> <?php echo $row['j_state']; ?></td>
                                                         <td> <?php echo $row['j_city']; ?></td>
                                                         <td> <?php echo $row['j_address']; ?></td>
                                                         <td> <?php echo $row['j_gender']; ?></td>
                                                        <td> <?php if($row['j_status'] < 1){ 
														//echo $user_pass;
														echo "***"; 
														}else{ echo "***"; } ?></td>
                                                        <td> 
                                                            <?php 
                                                                if(!empty($r_username)){
                                                                    echo "$r_username <em>$r_name</em>";
                                                                }
                                                            ?>
                                                        </td>
                                                        
                                                        <td> <?php  echo number_format($total_ref); ?></td>
                                                        <?php /*<td> <?php  echo $pay_status; ?></td>*/ ?>
                                                        
                                                        
                                                        <td> <?php echo FULL_DATE($row['j_date']); ?></td>
                                                        
                                                        
                                                        <td>
                                                            
                                                            <div class="btn-group dropup">
                                                            <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                                                Options
                                                            </button>
                                                            <div class="dropdown-menu">
                                                             
                                                            <a class="dropdown-item" href="<?php echo $dir; ?>profile?u=<?php echo ($row['j_id']); ?>">
                                                                <i class="anticon anticon-eye"></i>
                                                                <span class="m-l-10">View</span>
                                                            </a>
															
															
                                                            <div class="dropdown-divider"></div> 
                                                            <a class="dropdown-item" href="<?php echo $dir; ?>users/login.php?t_id=<?php echo $row['j_id'];?>&b_url=<?php echo $url;?>">
                                                                <i class="anticon anticon-login"></i>
                                                                <span class="m-l-10">Log In</span>
                                                            </a>
															
                                                            <?php 
                                                            if($row['j_status'] < 1){ ?>
                                                            <div class="dropdown-divider"></div>
                                                            <a class="dropdown-item" href="<?php echo $dir; ?>users/block-unblock.php?t_id=<?php echo $row['j_id'];?>&b_url=<?php echo $url;?>">
                                                                <?php if($row['j_blocked']<1){ ?>
                                                                <i class="anticon anticon-close-circle"></i>
                                                                <span class="m-l-10">Block</span>
                                                                <?php }else{ ?>
                                                                <i class="anticon anticon-check"></i>
                                                                <span class="m-l-10">UnBlock</span>
                                                                <?php } ?>
                                                            </a>
                                                            <?php } ?>
                                                            <?php 
                                                            if($row['j_status'] < 1){ ?>
                                                            <div class="dropdown-divider"></div>
                                                              <a class="dropdown-item" href="<?php echo $dir; ?>users/del.php?t_id=<?php echo $row['j_id'];?>&b_url=<?php echo $url;?>">
                                                                <i class="fa fa-trash"></i>
                                                                <span class="m-l-10">Delete</span>
                                                            </a>
                                                            <?php } ?>
                                                
                                                            </div>
                                                        </div>
                                    
                                                            
                                                        </td>
											
                                                        
													
                                                        
                                                    </tr>
                                                    <?php } ?>

                                                </tbody>
                                            </table>
                                             <br/>
                                            <p align="center">
                                                <?php if($offset+$limit < $total){ ?>
                                                <a class="btn btn-sm btn-default" href="?m=<?php echo $offset+$limit; ?>">Load Next<i class="fa fa-chevron-right text-2 ml-2"></i></a>
                                                <?php } ?>
                                                &nbsp; &nbsp;
                                                <?php if($offset > 0){ ?>
                                                <a class="btn btn-sm btn-default" href="?m=<?php echo $offset-$limit; ?>"><i class="fa fa-chevron-left text-2 ml-2"></i>  Previous</a>
                                                <?php } ?>
                                            </p>
                                        </div>
                                        
                                        
                                    </div>
                                    



                                    <?php }else{ //no record ?> 
                                    <div class="card-body">
                                        <div class="container">
                                            <div class="row">
                                                 <div class="col-md-12" style="text-align:center;">
                                                    <div class="avatar avatar-image avatar-lg avatar-red">
                                                        <i class="fa fa-times"></i>
                                                     </div>
                                                     <p class="text-center">No record found.</p>
                                                      
 
                                                 </div>
                                            </div>

                                        </div>
                                    </div>
                                    <?php } ?>

                                </div>