<div class="row">
    <div class="col-12 col-md-6 col-lg-8 order-md-2 mb-4 text-center">
        <div class="card">
            <div class="card-body text-center">
                
               
                <ul class="nav nav-pills nav-justified mb-1" role="tablist">
                    <li class="nav-item waves-effect waves-light" role="presentation">
                                                <a class="nav-link active" data-toggle="tab" id="levellb-tab" href="#levellb" role="tab" aria-controls="levellb" aria-selected="true">
                                                    <span class="d-block d-sm-none">A</span>
                                                    <span class="d-none d-sm-block">Level board</span> 
                                                </a>
                                            </li>
											 <?php if ($settings['activity_contest_reward'] != "") {
        $rewards = explode('|', $settings['activity_contest_reward'])
    ?>
                                        <li class="nav-item waves-effect waves-light" role="presentation">
                                                <a class="nav-link" data-toggle="tab" id="activitylb-tab" href="#activitylb" role="tab" aria-controls="activitylb" aria-selected="false" tabindex="-1">
                                                    <span class="d-block d-sm-none">B</span>
                                                    <span class="d-none d-sm-block">Activity board</span> 
                                                </a>
                                            </li>
                         <?php } ?>
    <?php if ($settings['offerwall_contest_reward'] != "") {
        $rewards = explode('|', $settings['offerwall_contest_reward'])
    ?>
                        <li class="nav-item waves-effect waves-light" role="presentation">
                                                <a class="nav-link" id="offerwalllb-tab" data-toggle="tab" href="#offerwalllb" role="tab" aria-controls="offerwalllb" aria-selected="false" tabindex="-1">
                                                    <span class="d-block d-sm-none">C</span>
                                                    <span class="d-none d-sm-block">Offerwall contest</span>    
                                                </a>
                                            </li>
									 <?php } ?>
								
    <?php if ($settings['referral_contest_reward'] != "") {
        $rewards = explode('|', $settings['referral_contest_reward'])
    ?>
											  <li class="nav-item waves-effect waves-light" role="presentation">
                                                <a class="nav-link" id="referral-tab" data-toggle="tab" href="#referral" role="tab" aria-controls="referral" aria-selected="false" tabindex="-1">
                                                    <span class="d-block d-sm-none">D</span>
                                                    <span class="d-none d-sm-block">Referral contest</span>    
                                                </a>
                                            </li>
											
											 <?php } ?>
    <?php if ($settings['faucet_contest_reward'] != "") {
        $rewards = explode('|', $settings['faucet_contest_reward'])
    ?>
											 <li class="nav-item waves-effect waves-light" role="presentation">
                                                <a class="nav-link" id="faucet-tab" data-toggle="tab" href="#faucet" role="tab" aria-controls="faucet" aria-selected="false" tabindex="-1">
                                                    <span class="d-block d-sm-none">E</span>
                                                    <span class="d-none d-sm-block">Faucet contest</span>    
                                                </a>
                                            </li>
											 <?php } ?>
    <?php if ($settings['shortlink_contest_reward'] != "") {
        $rewards = explode('|', $settings['shortlink_contest_reward'])
    ?>
											 <li class="nav-item waves-effect waves-light" role="presentation">
                                                <a class="nav-link" id="links-tab" data-toggle="tab" href="#links" role="tab" aria-controls="shortlink" aria-selected="false" tabindex="-1">
                                                    <span class="d-block d-sm-none">F</span>
                                                    <span class="d-none d-sm-block">Shortlink contest</span>    
                                                </a>
                                            </li>
											<?php } ?>
											
											
                                                                </ul>
                <div class="tab-content" id="iconTabContent-1">
                    <img src="/img/winboard.png" width="280em" draggable="false" class="img-fluid" alt="">
                    <div class="tab-pane fade active show" id="levellb" role="tabpanel" aria-labelledby="levellb-tab">
                        <p>Top 20 highest level users!</p>
           <div class="table-responsive">
                    <table class="table table-striped text-center">
                        <thead>
                            <tr>
                                <th scope="col">#</th>
                                <th scope="col">Username</th>
                                <th scope="col">Level</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            $rank = 1;
                            foreach ($topLevel as $u) {
                                echo '<tr><th scope="row">' . $rank++ . '</th><td class="username-rank">' . $u["username"] . '</td><td>' . $u["level"] . '</td></tr>';
                            }
                            ?>
                        </tbody>
                    </table>
                </div>

                    </div>
                    
                    <div class="tab-pane fade" id="activitylb" role="tabpanel" aria-labelledby="activitylb-tab">
                        <p>Top 20 claimers of this week!</p>
                                 <div class="table-responsive">
                     <div class="table-responsive">
                        <table class="table table-striped text-center">
                            <thead>
                                <tr>
                                    <th scope="col">#</th>
                                    <th scope="col">Username</th>
                                    <th scope="col">Level</th>
                                    <th scope="col">Exp</th>
                                    <th scope="col">Reward</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
                                $rank = 0;
                                foreach ($topClaimer as $u) {
                                    $reward = $rank < count($rewards) ? $rewards[$rank] : 0;
                                    echo '<tr><th scope="row">' . ++$rank . '</th><td class="username-rank">' . $u["username"] . '</td><td>' . $u["level"] . '</td><td>' . $u["claims"] . '</td><td>' . currency($reward, $settings['currency_rate']) . '</td></tr>';
                                }
                                ?>
                            </tbody>
                        </table>
                    </div>
                    </div>

                    </div>
                    
                    <div class="tab-pane fade" id="offerwalllb" role="tabpanel" aria-labelledby="offerwalllb-tab">
                        <p>Top 20 users of offerwall contest! Your offerwall claim this week: <?= $user['offerwall_count_tmp'] ?></p>
              <div class="table-responsive">
                        <table class="table table-striped text-center">
                            <thead>
                                <tr>
                                    <th scope="col">#</th>
                                    <th scope="col">Username</th>
                                    <th scope="col">Level</th>
                                    <th scope="col">Claims</th>
                                    <th scope="col">Reward</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
                                $rank = 0;
                                foreach ($topOfferwall as $u) {
                                    $reward = $rank < count($rewards) ? $rewards[$rank] : 0;
                                    echo '<tr><th scope="row">' . ++$rank . '</th><td class="username-rank">' . $u["username"] . '</td><td>' . $u["level"] . '</td><td>' . $u["offerwall_count_tmp"] . '</td><td>' . currency($reward, $settings['currency_rate']) . '</td></tr>';
                                }
                                ?>
                            </tbody>
                        </table>
                    </div>

                    </div>
                    
                    <div class="tab-pane fade" id="referral" role="tabpanel" aria-labelledby="referral-tab">
                        <p>Top 20 users of referral contest! Your referrals this week: <?= $user['ref_count'] ?></p>
          <div class="table-responsive">
                        <table class="table table-striped text-center">
                            <thead>
                                <tr>
                                    <th scope="col">#</th>
                                    <th scope="col">Username</th>
                                    <th scope="col">Level</th>
                                    <th scope="col">Claims</th>
                                    <th scope="col">Reward</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
                                $rank = 0;
                                foreach ($topShortlink as $u) {
                                    $reward = $rank < count($rewards) ? $rewards[$rank] : 0;
                                    echo '<tr><th scope="row">' . ++$rank . '</th><td class="username-rank">' . $u["username"] . '</td><td>' . $u["level"] . '</td><td>' . $u["shortlink_count_tmp"] . '</td><td>' . currency($reward, $settings['currency_rate']) . '</td></tr>';
                                }
                                ?>
                            </tbody>
                        </table>
                    </div>

                    </div>
                    
                    <div class="tab-pane fade" id="links" role="tabpanel" aria-labelledby="links-tab">
                        <p>Top 20 users of shortlink contest! Your shortlink claim this week: <?= $user['shortlink_count_tmp'] ?></p>
                      <div class="table-responsive">
                        <table class="table table-striped text-center">
                            <thead>
                                <tr>
                                    <th scope="col">#</th>
                                    <th scope="col">Username</th>
                                    <th scope="col">Level</th>
                                    <th scope="col">Claims</th>
                                    <th scope="col">Reward</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
                                $rank = 0;
                                foreach ($topShortlink as $u) {
                                    $reward = $rank < count($rewards) ? $rewards[$rank] : 0;
                                    echo '<tr><th scope="row">' . ++$rank . '</th><td class="username-rank">' . $u["username"] . '</td><td>' . $u["level"] . '</td><td>' . $u["shortlink_count_tmp"] . '</td><td>' . currency($reward, $settings['currency_rate']) . '</td></tr>';
                                }
                                ?>
                            </tbody>
                        </table>
                    </div>

                    </div>
                    
                    <div class="tab-pane fade" id="faucet" role="tabpanel" aria-labelledby="faucet-tab">
                        <p>Top 20 users of faucet contest! Your faucet claim this week: <?= $user['faucet_count_tmp'] ?></p>
                     <div class="table-responsive">
                        <table class="table table-striped text-center">
                            <thead>
                                <tr>
                                    <th scope="col">#</th>
                                    <th scope="col">Username</th>
                                    <th scope="col">Level</th>
                                    <th scope="col">Claims</th>
                                    <th scope="col">Reward</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
                                $rank = 0;
                                foreach ($topFaucet as $u) {
                                    $reward = $rank < count($rewards) ? $rewards[$rank] : 0;
                                    echo '<tr><th scope="row">' . ++$rank . '</th><td class="username-rank">' . $u["username"] . '</td><td>' . $u["level"] . '</td><td>' . $u["faucet_count_tmp"] . '</td><td>' . currency($reward, $settings['currency_rate']) . '</td></tr>';
                                }
                                ?>
                            </tbody>
                        </table>
                    </div>
                    </div>
                
                
                </div>
            </div>
        </div>
    </div>
    <div class="col-6 col-md-2 col-lg-2 order-md-1 p-0 left-ads"><?= $settings['mad_left_ad'] ?></div>
    <div class="col-6 col-md-2 col-lg-2 order-md-3 p-0 right-ads"><?= $settings['mad_right_ad'] ?></div>
</div>