Skip to content
Extraits de code Groupes Projets
Sélectionner une révision Git
  • 2f03118cfa657ee2a5ba1db77ca7440ae52b1f75
  • master par défaut protégée
  • test
  • tichadou2015-master-patch-52256
4 résultats

quizz.py

Blame
  • Bifurcation depuis Loris TICHADOU / nardco
    Le projet source a une visibilité limitée.
    favoris.php 6,38 Kio
    <?php
    include "./config/database.php";
    include "header.php";
    if (isset($_SESSION["authent"]) && $_SESSION['authent'] == 0){
    	echo "
    	<meta http-equiv=\"refresh\" content=\"0; url=index.php\">";
    	exit();
    }
    ?>
    
        <div class="text-center fadeInUp animated pt-4">
            <h1>Favoris</h1>
        </div>
    </header>
    
    <section class="one">
        <div class="container">
            <h2>Top 10 Favoris</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 NATURAL JOIN favoris WHERE nb_youtube != 0 && nb_instagram != 0 && id_user = ".$_SESSION["id"]." ORDER BY nb DESC LIMIT 10");
                    $compt = 1;
                    $compt2=1;
                    while($row = mysqli_fetch_assoc($result)) : $compt2=2;?>
                        <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>
            <?php if ($compt2==1) echo "Pas de favoris <br/><br/><br/>"; ?>
        </div>
    </section>
    <section class="one" style="background-color:#efefef;">
        <div class="container">
            <h2>Mes Favoris</h2>
            <div class="divider"></div>
            <table class="table">
               
                
                <?php
                    $resultI = mysqli_query($link, "SELECT * FROM influenceurs NATURAL JOIN favoris WHERE id_user = ".$_SESSION["id"]." ORDER BY nom_artiste");
                    $compt = 1;
                    while($row = mysqli_fetch_assoc($resultI)) : $compt =2?>
                        <tr>
                    <td> <b> <?php echo $row['nom_artiste']; ?> </b> </td>
                    <td>
                    <?php  if ( (isset($_GET["youtube"]) || !isset($_GET["instagram"])) && !empty($row['tag_youtube'])) { ?>
                    <a href="youtube.php?user=<?php echo $row['tag_youtube'];?>">  <i class="fab fa-youtube fa-2x"></i> </a>
                    <?php } ?>
                    </td>
                    <td>
                    <?php if  ( (isset($_GET["instagram"]) || !isset($_GET["youtube"])) && !empty($row['tag_instagram'])) { ?>
                    <a href="instagram-profil.php?user=<?php echo $row['tag_instagram'];?>">  <i class="fab fa-instagram fa-2x"></i> </a>
                    <?php } ?>
                    </td>
                    <td>
                    <?php if  (( (!isset($_GET["instagram"]) && !isset($_GET["youtube"])) || ( isset($_GET["instagram"]) && isset($_GET["youtube"]))) && (!empty($row['tag_instagram']) && !empty($row['tag_youtube']))) { ?>
                    <a href="page_globale.php?user=<?php echo $row['tag_instagram'];?>">  <i class="fa fa-file fa-2x"></i> </a>
                    <?php } ?>
                    </td>
                    <?php
                    endwhile; if ($compt==1) echo "Pas de favoris";?>
    
                
            </table>
        </div>
    </section>
    <section class="one">
        <div class="container">
            <h2>Statistiques</h2>
            <div class="divider"></div>
            <div id="chartContainer" style="height: 370px; max-width: 920px; margin: 0px auto;"></div>
            
        </div>
    </section>
    
    <script src="ressources/canvasjs/canvasjs.min.js"></script>
    <script>
    
    var influ = new Array();
    <?php 
    $result2 = mysqli_query($link, "SELECT nom_artiste, nb_youtube + nb_instagram as nb, tag_instagram FROM influenceurs NATURAL JOIN favoris WHERE nb_youtube != 0 && nb_instagram != 0 && id_user = ".$_SESSION["id"]." ORDER BY nb DESC LIMIT 10");
    while($row = mysqli_fetch_assoc($result2)) :?>
        influ.push({y: <?= $row['nb'] ?>,label: '<?= $row['nom_artiste'] ?>'});
    <?php endwhile; ?>
    
    if (influ.length > 0) {
        window.onload = function () {
        
        var chart = new CanvasJS.Chart("chartContainer", {
            backgroundColor: "transparent ",
            theme: "theme2",
            animationEnabled: true,
            title:{
                text: "Répartitions des 10 premiers favoris"
            },
            legend:{
                cursor: "pointer",
            },
            data: [{
                type: "doughnut",
                innerRadius: 90,
                toolTipContent: "<b>{label}</b>: {y} foollowers (#percent%)",
                dataPoints: influ,
            }]
        });
        chart.options.data[0].dataPoints = influ;
        chart.render();
        
        
        }
    }
    else {
        document.getElementById('chartContainer').innerHTML = 'Pas de favoris';
    }
    </script>
    
    <?php   
    include "footer.php"
    ?>