Skip to content
Extraits de code Groupes Projets
Valider d19b1b6f rédigé par mattgoss's avatar mattgoss
Parcourir les fichiers

petites modifications

parent d3d288c3
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Hôte : 127.0.0.1:3306
-- Généré le : mer. 18 déc. 2019 à 18:15
-- Hôte : localhost:8889
-- Généré le : mer. 18 déc. 2019 à 21:34
-- Version du serveur : 5.7.26
-- Version de PHP : 7.2.18
-- Version de PHP : 7.3.8
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de données : `pima`
--
......@@ -28,8 +20,7 @@ SET time_zone = "+00:00";
-- Structure de la table `categorie`
--
DROP TABLE IF EXISTS `categorie`;
CREATE TABLE IF NOT EXISTS `categorie` (
CREATE TABLE `categorie` (
`id_categorie` int(2) NOT NULL,
`nom_categorie` varchar(30) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
......@@ -52,20 +43,25 @@ INSERT INTO `categorie` (`id_categorie`, `nom_categorie`) VALUES
-- Structure de la table `favoris`
--
DROP TABLE IF EXISTS `favoris`;
CREATE TABLE IF NOT EXISTS `favoris` (
CREATE TABLE `favoris` (
`id_artiste` int(11) NOT NULL,
`id_user` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Déchargement des données de la table `favoris`
--
INSERT INTO `favoris` (`id_artiste`, `id_user`) VALUES
(4, 2);
-- --------------------------------------------------------
--
-- Structure de la table `influenceurs`
--
DROP TABLE IF EXISTS `influenceurs`;
CREATE TABLE IF NOT EXISTS `influenceurs` (
CREATE TABLE `influenceurs` (
`id_artiste` int(11) NOT NULL,
`nom_artiste` varchar(30) NOT NULL,
`sexe` varchar(1) NOT NULL,
......@@ -73,8 +69,7 @@ CREATE TABLE IF NOT EXISTS `influenceurs` (
`tag_instagram` varchar(30) NOT NULL,
`nb_youtube` int(11) NOT NULL,
`nb_instagram` int(11) NOT NULL,
`id_categorie` int(11) NOT NULL,
PRIMARY KEY (`id_artiste`)
`id_categorie` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
......@@ -118,8 +113,7 @@ INSERT INTO `influenceurs` (`id_artiste`, `nom_artiste`, `sexe`, `tag_youtube`,
-- Structure de la table `users`
--
DROP TABLE IF EXISTS `users`;
CREATE TABLE IF NOT EXISTS `users` (
CREATE TABLE `users` (
`id_user` int(11) NOT NULL,
`nom` varchar(30) NOT NULL,
`prenom` varchar(30) NOT NULL,
......@@ -137,8 +131,19 @@ INSERT INTO `users` (`id_user`, `nom`, `prenom`, `mail`, `mdp`, `bday`) VALUES
(2, 'GOSSET', 'Matthieu', 'matthieu.gosset@yahoo.fr', 'matthieu', '1998-04-25'),
(3, 'sellambin', 'hugo', 'hugo91@gmail.com', 'hugohugoo', '2004-12-04'),
(4, 'Caille', 'Louis', 'louis.caille@hotmail.fr', 'helloworld', '1998-08-13');
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
--
-- Index pour les tables déchargées
--
--
-- Index pour la table `favoris`
--
ALTER TABLE `favoris`
ADD PRIMARY KEY (`id_artiste`,`id_user`);
--
-- Index pour la table `influenceurs`
--
ALTER TABLE `influenceurs`
ADD PRIMARY KEY (`id_artiste`);
\ No newline at end of file
......@@ -26,6 +26,30 @@ if (isset($_SESSION["authent"]) && $_SESSION['authent'] == 0){
</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;
......@@ -34,7 +58,7 @@ if (isset($_SESSION["authent"]) && $_SESSION['authent'] == 0){
<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>
<td class="text-right"><?= number_format_short($row['nb'] , $precision = 1 ) ?></td>
</tr>
<?php
$compt=$compt+1;
......
......@@ -108,9 +108,9 @@ $(document).ready(function(){
</td>
<?php if ($_SESSION["authent"]==1){?>
<!-- ADD TO FAVORITE BUTTON -->
<td>
<!-- <td>
<span id = heart><i class="fa fa-heart-o fa-2x" aria-hidden="true"></i> </span>
</td>
</td> -->
<?php }?>
</tr>
<?php } } ?>
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter