diff --git a/connexion.php b/connexion.php index 7ac0222305eb704145e21808cb1dddca8ecbc02b..92e0c2bbfcf8d787a329fafe072aab00d6c001cf 100644 --- a/connexion.php +++ b/connexion.php @@ -14,7 +14,8 @@ if (isset($_SESSION['authent'])) : if ($row['mail'] == $peusdo && $row['mdp'] == $password) : $_SESSION['authent'] = 1; $_SESSION['pseudo'] = $row['mail']; - $_SESSION['name'] = $row['prenom'] + $_SESSION['name'] = $row['prenom']; + $_SESSION['id']=$row['id_user'] ?> <div class="row"> <div class="col-sm-4 ml-auto"> diff --git a/favoris.php b/favoris.php index 5baad6e412274706128c84981994650b93d1b478..7c576ae1a7bce059bd3145e3040fa1930ee30176 100644 --- a/favoris.php +++ b/favoris.php @@ -1 +1,84 @@ -<?php echo "vide"?> \ No newline at end of file +<?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 + $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; + while($row = mysqli_fetch_assoc($result)) : $compt=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"><?= $row['nb'] ?></td> + </tr> + <?php + + endwhile; ?> + </tbody> + + </table> + <?php if ($compt==1) echo "Pas de favoris <br/><br/><br/>"; ?> + + <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"]." "); + $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?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> + + + +<?php +include "footer.php" +?> \ No newline at end of file diff --git a/header.php b/header.php index 00a8e87337792905cd97558b15c95a4a15c4f9b5..76d95e14d7e55d52a7287b837852f41624d4b3f1 100644 --- a/header.php +++ b/header.php @@ -132,6 +132,9 @@ <li class=\"nav-item\"> <a class=\"nav-link\" href=\"tab.php\">Tableau de bord</a> </li> + <li class=\"nav-item\"> + <a class=\"nav-link\" href=\"favoris.php\">Mes favoris</a> + </li> <li class=\"nav-item\"> <a class=\"nav-link\" href=\"deconnexion.php\" id=\"disconnected\" onclick=\"discoPop()\">Déconnexion</a> </li>";