Skip to content
Extraits de code Groupes Projets
Sélectionner une révision Git
  • 43ff318e4bbb3d9ffa4450ca970616c795b96c34
  • master par défaut protégée
2 résultats

classement.php

Blame
  • classement.php 5,50 Kio
    <?php
    include "./config/database.php";
    include "header.php";
    ?>
    
        <div class="text-center fadeInUp animated pt-4">
            <h1>Classement</h1>
        </div>
    </header>
    
    <section class="one">
        <div class="container">
            <h2>Top 10 global</h2>
            <div class="divider"></div>
            <table class="table">
                <thead class="thead-dark">
                    <tr>
                    <th scope="col">#</th>
                    <th scope="col" class="text-right">Nom</th>
                    <th scope="col" class="text-right">Nombre de Followers</th>
                    </tr>
                </thead>
                <tbody>
                        <?php 
                            function number_format_short( $n, $precision = 1 ) {
                                if ($n < 900) {
                                    $n_format = number_format($n, $precision);
                                    $suffix = '';
                                } else if ($n < 900000) {
                                    $n_format = number_format($n / 1000, $precision);
                                    $suffix = 'K';
                                } else if ($n < 900000000) {
                                    $n_format = number_format($n / 1000000, $precision);
                                    $suffix = 'M';
                                } else if ($n < 900000000000) {
                                    $n_format = number_format($n / 1000000000, $precision);
                                    $suffix = 'B';
                                } else {
                                    $n_format = number_format($n / 1000000000000, $precision);
                                    $suffix = 'T';
                                }
                                if ( $precision > 0 ) {
                                    $dotzero = '.' . str_repeat( '0', $precision );
                                    $n_format = str_replace( $dotzero, '', $n_format );
                                }
                            return $n_format . $suffix;}
                            ?>
    
                <?php
                    $result = mysqli_query($link, "SELECT nom_artiste, nb_youtube + nb_instagram as nb, tag_instagram FROM influenceurs WHERE nb_youtube != 0 && nb_instagram != 0 ORDER BY nb DESC LIMIT 10");
                    $compt = 1;
                    while($row = mysqli_fetch_assoc($result)) : ?>
                        <tr onclick="document.location = 'page_globale.php?user=<?= $row['tag_instagram'] ?>';" class="table-click">
                                <th scope="row"><?= $compt ?></th>
                                <td class="text-right"><?php if ($compt == 1) : ?><i class="fas fa-medal"></i><?php endif;?> <?= $row['nom_artiste'] ?></td>
                                <td class="text-right"><?= number_format_short($row['nb'] , $precision = 1 )?></td>
                        </tr>
                    <?php
                        $compt = $compt + 1;
                    endwhile; ?>
                </tbody>
            </table>
    
            <h2>Top 10 Instagram</h2>
            <div class="divider"></div>
            <table class="table">
                <thead class="bg-info">
                    <tr>
                    <th scope="col">#</th>
                    <th scope="col" class="text-right">Nom</th>
                    <th scope="col" class="text-right">Nombre de Followers</th>
                    </tr>
                </thead>
                <tbody>
                <?php
                    $resultI = mysqli_query($link, "SELECT nom_artiste, nb_instagram as nb, tag_instagram FROM influenceurs WHERE nb_instagram != 0 ORDER BY nb DESC LIMIT 10");
                    $compt = 1;
                    while($row = mysqli_fetch_assoc($resultI)) : ?>
                        <tr onclick="document.location = 'instagram-profil.php?user=<?= $row['tag_instagram'] ?>';" class="table-click">
                            <th scope="row"><?= $compt ?></th>
                            <td class="text-right"><?php if ($compt == 1) : ?><i class="fas fa-medal"></i><?php endif;?> <?= $row['nom_artiste'] ?></td>
                            <td class="text-right"><?= number_format_short($row['nb'] , $precision = 1 ) ?></td>
                        </tr>
                    <?php
                        $compt = $compt + 1;
                    endwhile; ?>
                </tbody>
            </table>
            <h2>Top 10 Youtube</h2>
            <div class="divider"></div>
            <table class="table">
                <thead class="bg-danger">
                    <tr>
                    <th scope="col">#</th>
                    <th scope="col" class="text-right">Nom</th>
                    <th scope="col" class="text-right">Nombre de Followers</th>
                    </tr>
                </thead>
                <tbody>
                <?php
                    $resultY = mysqli_query($link, "SELECT nom_artiste, nb_youtube as nb, tag_youtube FROM influenceurs WHERE nb_youtube != 0 ORDER BY nb DESC LIMIT 10");
                    $compt = 1;
                    while($row = mysqli_fetch_assoc($resultY)) : ?>
                        <tr onclick="document.location = 'youtube.php?user=<?= $row['tag_youtube'] ?>';" class="table-click">
                            <th scope="row"><?= $compt ?></th>
                            <td class="text-right"><?php if ($compt == 1) : ?><i class="fas fa-medal"></i><?php endif;?> <?=  $row['nom_artiste'] ?></td>
                            <td class="text-right"><?= number_format_short($row['nb'] , $precision = 1 ) ?></td>
                        </tr>
                    <?php
                        $compt = $compt + 1;
                    endwhile; ?>
                </tbody>
            </table>
        </div>
    </section>
    
    
    
    <?php   
    include "footer.php"
    ?>