Sélectionner une révision Git
result_search.php 4,59 Kio
<!-- https://codepen.io/mapk/pen/ZOQqaQ -->
<!-- https://jsfiddle.net/69ww31n3/ -->
<?php
include "./config/database.php";
/* redirection quand nom artiste exact */
$tag = $_GET["email"];
$influenceurs = $bdd->query("SELECT `nom_artiste`, `tag_youtube`, `tag_instagram` FROM `influenceurs` WHERE `nom_artiste`='$tag'");
if ($inf=$influenceurs->fetch()) {
if (isset($_GET["youtube"])) {
if (isset($_GET["instagram"])) {
if (!empty($inf['tag_youtube']) && !empty($inf['tag_instagram'])) {
header('Location: page_globale.php?user='.$tag);
}
}
else {
if (!empty($inf['tag_youtube'])) {
header('Location: youtube?user='.$inf['tag_youtube']);
}
}
}
else {
if (isset($_GET["instagram"])) {
if (!empty($inf['tag_instagram'])) {
header('Location: instagram-profil.php?user='.$inf['tag_instagram']);
}
}
}
}
include "header.php";
?>
<!-- ADD TO FAVORITES JS CODE -->
<head>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="https://use.fontawesome.com/0206006232.js"></script>
<script>
// It checks to see if the span id #heart has "liked" class, if not it run the else statement and adds the "liked" class, on a 2nd click it see that it has the "liked" class so it replaces the ihherHTML and removes class, on 3rd click it runs the else statement again cause there is no "liked" class(remomved on 2nd click).
$(document).ready(function(){
$("#heart").click(function(){
if($("#heart").hasClass("liked")){
$("#heart").html('<i class="fa fa-heart-o fa-2x" aria-hidden="true"></i>');
$("#heart").removeClass("liked");
}else{
$("#heart").html('<i class="fa fa-heart fa-2x" aria-hidden="true"></i>');
$("#heart").addClass("liked");
}
});
});
</script>
<style>
.fa-heart-o {
color: red;
cursor: pointer;
}
.fa-heart {
color: red;
cursor: pointer;
}
</style>
<div class="text-center fadeInUp animated pt-4">
<h1>Résultats recherche</h1>
</div>
</header>
<body>
<section class="one">
<div class="container">
<table class="table">
<tbody>
<?php
/* récupération des données de la table influenceurs */
if ((isset($_GET["youtube"]) && isset($_GET["instagram"])) || (!isset($_GET["youtube"]) && !isset($_GET["instagram"]))) {
$result = $bdd->query("SELECT * FROM `influenceurs` WHERE `nom_artiste` LIKE '$tag%' OR `tag_youtube` LIKE '$tag%' OR `tag_instagram` LIKE '$tag%' ORDER BY `nom_artiste`");
}
elseif (isset($_GET["youtube"]) && !isset($_GET["instagram"])) {
$result = $bdd->query("SELECT * FROM `influenceurs` WHERE (`nom_artiste` LIKE '$tag%' OR `tag_youtube` LIKE '$tag%') AND `tag_youtube` > '' ORDER BY `nom_artiste`");
}
else {
$result = $bdd->query("SELECT * FROM `influenceurs` WHERE (`nom_artiste` LIKE '$tag%' OR `tag_instagram` LIKE '$tag%') AND `tag_instagram` > '' ORDER BY `nom_artiste`");
}
/* affichage des influenceurs avec un lien vers page insta ou youtube selon ce qui est coché */
if (!empty($result)) {
while ($row=$result->fetch()) { ?>
<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 if ($_SESSION["authent"]==1){?>
<!-- ADD TO FAVORITE BUTTON -->
<!-- <td>
<span id = heart><i class="fa fa-heart-o fa-2x" aria-hidden="true"></i> </span>
</td> -->
<?php }?>
</tr>
<?php } } ?>
</tbody>
</table>
</div>
</section>
<?php
include "footer.php"
?>