aboutsummaryrefslogtreecommitdiff
path: root/Html/sidebar.php
diff options
context:
space:
mode:
authorcitizenz7 <citizenz7@protonmail.com>2017-04-20 18:50:55 +0200
committercitizenz7 <citizenz7@protonmail.com>2017-04-20 18:50:55 +0200
commit5fd9fa480f302902328b81f912dd67ce378284f8 (patch)
tree66234843ae2857fda12442e4f7577c527d48977c /Html/sidebar.php
parentebe731862c7c741171138b1083906f391fc35aff (diff)
downloadfreetorrent-5fd9fa480f302902328b81f912dd67ce378284f8.tar.xz
freetorrent-5fd9fa480f302902328b81f912dd67ce378284f8.zip
V.1.4.6
Diffstat (limited to 'Html/sidebar.php')
-rw-r--r--Html/sidebar.php441
1 files changed, 441 insertions, 0 deletions
diff --git a/Html/sidebar.php b/Html/sidebar.php
new file mode 100644
index 0000000..76e889a
--- /dev/null
+++ b/Html/sidebar.php
@@ -0,0 +1,441 @@
+<div class="sidebar">
+
+<ul>
+
+
+<li>
+ <h4><span>Réseaux et partages</span></h4>
+ <a href="https://spacejerk.fr"><img src="<?php echo SITEURL; ?>/images/social/mastodon.png" style="width: 40px; height: 40px;" alt="Social Network Mastodon" title="Instance Mastodon spacejerk.fr" /></a>&nbsp;&nbsp;&nbsp;&nbsp;
+ <a href="https://www.facebook.com/<?php echo SITEDISQUS; ?>"><img src="<?php echo SITEURL; ?>/images/social/facebook-icon.png" alt="Facebook" style="width: 40px; height: 40px;" /></a>&nbsp;&nbsp;&nbsp;&nbsp;
+ <a href="https://twitter.com/<?php echo SITENAME; ?>"><img src="<?php echo SITEURL; ?>/images/social/twitter-icon.png" alt="Twitter" style="width: 40px; height: 40px;" /></a>&nbsp;&nbsp;&nbsp;&nbsp;
+ <a href="https://plus.google.com/u/0/113771664239490205939/posts"><img src="<?php echo SITEURL; ?>/images/social/google-plus-icon.png" alt="Google+" style="width: 40px; height: 40px;" /></a>&nbsp;&nbsp;&nbsp;&nbsp;
+ <br />
+ <a href="<?php echo SITEURL; ?>/rss.php"><img src="<?php echo SITEURL; ?>/images/social/rss-icon.png" alt="RSS" style="width: 40px; height: 40px;" /></a>&nbsp;&nbsp;&nbsp;&nbsp;
+ <a href="<?php echo SITEURL; ?>/contact.php"><img src="<?php echo SITEURL; ?>/images/social/mail-icon.png" alt="Mail" style="width: 40px; height: 40px;" /></a>&nbsp;&nbsp;&nbsp;&nbsp;
+</li>
+
+<li>
+ <fieldset>
+ <legend><h4><span>Menu</span></h4></legend>
+
+ <?php
+ if($user->is_logged_in() && $_SESSION['username'] == 'mumbly') {
+ ?>
+ <?php
+ $query=$db->query('SELECT avatar FROM blog_members WHERE username = "mumbly"');
+ $data = $query->fetch();
+ $avatar = html($data['avatar']);
+ ?>
+
+ <img src="<?php echo SITEURL; ?>/images/avatars/<?php echo $avatar; ?>" alt="<?php echo html($_SESSION['username']); ?>" style="float:right; width:40px; height:40px; margin-bottom:15px;" />
+ <span style="font-weight: bold; font-size: 13px;">Bienvenue <?php echo html($_SESSION['username']); ?> !</span>
+ <br />
+
+ <?php
+ $stmtmess = $db->query('SELECT blog_messages.messages_titre, blog_messages.messages_date, blog_members.username as expediteur, blog_messages.messages_id as id_message FROM blog_messages, blog_members WHERE blog_messages.messages_id_destinataire = "'.$_SESSION['userid'].'" AND blog_messages.messages_id_expediteur = blog_members.memberID AND blog_messages.messages_lu = "0"');
+ $nbmessages = $stmtmess->rowCount();
+
+ $stmtnbmess = $db->query('SELECT blog_messages.messages_id, blog_members.memberID FROM blog_messages, blog_members WHERE blog_messages.messages_id_destinataire = "'.$_SESSION['userid'].'" AND blog_messages.messages_id_expediteur = blog_members.memberID');
+ $nbstmtnbmess = $stmtnbmess->rowCount();
+ ?>
+
+ <ul class="blocklist">
+ <li>
+ <?php
+ echo '<a href="'.SITEURL.'/admin/messagerie.php?membre='.html($_SESSION['username']).'">
+ <img style="vertical-align: text-bottom;" src="'.SITEURL.'/images/Email-icon.png" /> Messagerie : ';
+ if($nbmessages >= 1 ) {
+ echo '<img style="vertical-align: text-bottom; width: 16px; height: 1 6px;" src="'.SITEURL.'/images/envelope-newmail.gif" /> ';
+ }
+ echo '<span style="color: orange; font-size: 10px;">['.$nbmessages.'&nbsp;-&nbsp;'.$nbstmtnbmess.']</span>';
+ echo '</a>';
+ ?>
+ </li>
+
+ <li><a href="<?php echo SITEURL; ?>/admin/upload.php"><img src="<?php echo SITEURL; ?>/images/uptorr.png" /> Ajouter un torrent</a></li>
+ <li><a href="<?php echo SITEURL; ?>/admin/profil.php?membre=<?php echo html($_SESSION['username']); ?>"><img src="<?php echo SITEURL; ?>/images/user.png" /> Profil</a></li>
+ <li><a href="<?php echo SITEURL; ?>/admin"><img src="<?php echo SITEURL; ?>/images/admin.png" /> Admin</a></li>
+ <li><a href="<?php echo SITEURL; ?>/stats"><img src="<?php echo SITEURL; ?>/images/stats.png" /> Stats</a></li>
+ <li><a href="<?php echo SITEURL; ?>/bbclone"><img src="<?php echo SITEURL; ?>/images/stats.png" /> bbclone</a></li>
+ <li><a href="<?php echo SITEURL; ?>/admin/logout.php"><img src="<?php echo SITEURL; ?>/images/logout.png" /> Déconnexion</a></li>
+ </ul>
+ <?php }
+
+ elseif($user->is_logged_in()) {
+
+ $session_username = html($_SESSION['username']);
+ $query=$db->prepare('SELECT avatar FROM blog_members WHERE username = :session_username');
+ $query->bindValue(':session_username',$session_username,PDO::PARAM_STR);
+ $query->execute();
+ $data = $query->fetch();
+
+ if(empty($data['avatar'])) {
+ $avatar = 'avatar-profil.png';
+ }
+ else {
+ $avatar = html($data['avatar']);
+ }
+
+ ?>
+ <ul class="blocklist">
+ <img src="<?php echo SITEURL; ?>/images/avatars/<?php echo $avatar; ?>" alt="<?php echo $session_username; ?>" style="float: right; width: 40px; height: 40px;" />
+ <span style="font-weight: bold;">Bienvenue <?php echo $session_username; ?> !</span>
+ <br />
+
+ <?php
+ $stmtmess = $db->query('SELECT blog_messages.messages_titre, blog_messages.messages_date, blog_members.username as expediteur, blog_messages.messages_id as id_message FROM blog_messages, blog_members WHERE blog_messages.messages_id_destinataire = "'.$_SESSION['userid'].'" AND blog_messages.messages_id_expediteur = blog_members.memberID AND blog_messages.messages_lu = "0"');
+ $nbmessages = $stmtmess->rowCount();
+
+ $stmtnbmess = $db->query('SELECT blog_messages.messages_id, blog_members.memberID FROM blog_messages, blog_members WHERE blog_messages.messages_id_destinataire = "'.$_SESSION['userid'].'" AND blog_messages.messages_id_expediteur = blog_members.memberID');
+ $nbstmtnbmess = $stmtnbmess->rowCount();
+ ?>
+
+ <li>
+ <?php
+ echo '<a href="'.SITEURL.'/admin/messagerie.php?membre='.$session_username.'">
+ <img style="vertical-align: text-bottom;" src="'.SITEURL.'/images/Email-icon.png" /> Messagerie : ';
+ if($nbmessages >= 1 ) {
+ echo '<img style="vertical-align: text-bottom; width: 16px; height: 1 6px;" src="'.SITEURL .'/images/envelope-newmail.gif" /> ';
+ }
+ echo '<span style="color: orange; font-size: 10px;">[<span style="font-weight:bold;">'.$nbmessages.'</span>&nbsp;-&nbsp;'.$nbstmtnbmess.']</span>';
+ echo '</a>';
+ ?>
+ </li>
+
+ <li><a href="<?php echo SITEURL; ?>/admin/upload.php"><img src="<?php echo SITEURL; ?>/images/uptorr.png" /> Ajouter un torrent</a></li>
+ <li><a href="<?php echo SITEURL; ?>/admin/profil.php?membre=<?php echo $session_username; ?>"><img src="<?php echo SITEURL; ?>/images/user.png" /> Profil</a></li>
+ <li><a href="<?php echo SITEURL; ?>/admin/logout.php"><img src="<?php echo SITEURL; ?>/images/logout.png" /> Déconnexion</a></li>
+ </ul>
+
+ <?php }
+
+ elseif(!$user->is_logged_in()) {
+ ?>
+
+ <ul class="blocklist">
+ <li><a href="<?php echo SITEURL; ?>/admin/login.php">Connexion</a></li>
+ <li><a href="<?php echo SITEURL; ?>/admin/signup.php"><span style="font-weight: bold;">> Créer un compte </span></a></li>
+ </ul>
+ <?php } ?>
+
+ </fieldset>
+</li>
+
+<li>
+ <fieldset>
+ <legend><h4><span>Catégories</span></h4></legend>
+ <ul class="blocklist">
+ <div class="select">
+ <select onchange="document.location.href = this.value">
+ <option>Choisir une catégorie</option>
+ <?php
+ $stmt = $db->query('SELECT catTitle, catSlug FROM blog_cats ORDER BY catTitle ASC');
+ while($row = $stmt->fetch()){
+ echo '<option value="'.SITEURL.'/c-'.html($row['catSlug']).'">'.html($row['catTitle']).'</option>';
+ }
+ ?>
+ </select>
+ </div>
+ </ul>
+ </fieldset>
+</li>
+
+<li>
+ <fieldset>
+ <legend><h4><span>Licences</span></h4></legend>
+ <ul class="blocklist">
+ <div class="select">
+ <select onchange="document.location.href = this.value">
+ <option>Choisir une licence</option>
+ <?php
+ $stmt = $db->query('SELECT licenceTitle, licenceSlug FROM blog_licences ORDER BY licenceTitle ASC');
+ while($row = $stmt->fetch()){
+ echo '<option value="'.SITEURL.'/l-'.html($row['licenceSlug']).'">'.html($row['licenceTitle']).'</option>';
+ }
+ ?>
+ </select>
+ </div>
+ </ul>
+ </fieldset>
+</li>
+
+<li>
+ <fieldset>
+ <legend><h4><span>Archives</span></h4></legend>
+ <ul class="blocklist">
+ <div class="select">
+ <select onchange="document.location.href = this.value">
+ <option>Choisir un mois</option>
+ <?php
+ $stmt = $db->query("SELECT Month(postDate) as Month, Year(postDate) as Year FROM blog_posts_seo GROUP BY Month(postDate), Year(postDate) ORDER BY postDate DESC");
+ while($row = $stmt->fetch()){
+ $monthName = date_fr("F", mktime(0, 0, 0, html($row['Month']), 10));
+ $year = date_fr(html($row['Year']));
+ $slug = 'a-'.html($row['Month']).'-'.html($row['Year']);
+ echo '<option value="'.SITEURL.'/'.$slug.'">'.$monthName.'&nbsp;'.$year.'</option>';
+ }
+ ?>
+ </select>
+ </div>
+ </ul>
+ </fieldset>
+</li>
+
+
+<li>
+ <fieldset>
+ <legend><h4><span>Commentaires</span></h4></legend>
+ <ul>
+ <li>
+ <script type="text/javascript" src="http://<?php echo SITEDISQUS; ?>.disqus.com/recent_comments_widget.js?num_items=3&hide_mods=0&color=grey&hide_avatar=0&avatar_size=100&excerpt_length=70"></script>
+ </li>
+ </ul>
+ </fieldset>
+</li>
+
+
+<li>
+ <fieldset>
+ <legend><h4><span>Statistiques du site</span></h4></legend>
+
+ <fieldset>
+ <legend style="font-size: 14px;">Membres & Visiteurs</legend>
+ <ul>
+ <?php
+ // NOMBRE DE MEMBRES INSCRITS
+ // On ne compte pas le compte visiteur qui porte l'ID 32 et pas les non-validés
+ $stmt3 = $db->query('SELECT COUNT(memberID) AS membres FROM blog_members WHERE memberID != 32 AND active = "yes"');
+ $row3 = $stmt3->fetch();
+
+ //echo '<fieldset>';
+ echo '<li>&rsaquo; <span>Membres inscrits :</span> '.html($row3['membres']).'</li>';
+
+ // NOMBRE DE MEMBRES NON VALIDES
+ $stmt4 = $db->query('SELECT COUNT(memberID) AS membres FROM blog_members WHERE memberID !=32 AND active != "yes" AND active != "no"');
+ $row4 = $stmt4->fetch();
+
+ echo '<li>&rsaquo; <span>A valider :</span> '.html($row4['membres']).'</li>';
+
+ // NOMBRE DE PERSONNES CONNECTEES SUR LE SITE
+ $stmt = $db->prepare('SELECT COUNT(*) AS nbre_entrees FROM connectes WHERE ip = :ip ');
+ $stmt->execute(array(
+ ':ip' => $_SERVER['REMOTE_ADDR']
+ ));
+ $donnees = $stmt->fetch();
+
+ // S'il y a une $_SESSION, c'est un membre connecté
+ if(isset($_SESSION['username'])) {
+ $stmt2 = $db->prepare('UPDATE connectes SET timestamp = :timestamp, pseudo = :pseudo WHERE ip = :ip') ;
+ $stmt2->execute(array(
+ ':timestamp' => time(),
+ ':pseudo' => html($_SESSION['username']),
+ ':ip' => $_SERVER['REMOTE_ADDR']
+ ));
+ }
+
+ else { // Ou bien il n'y a aucune $_SESSION (ce n'est pas un membre connecté), c'est un "Visiteur"
+ $pseudo = 'Visiteur';
+ if ($donnees['nbre_entrees'] == 0) // L'IP ne se trouve pas dans la table, on va l'ajouter.
+ {
+ $stmt1 = $db->prepare('INSERT INTO connectes VALUES (:ip, :pseudo, :timestamp)');
+ $stmt1->execute(array(
+ ':ip' => $_SERVER['REMOTE_ADDR'],
+ ':pseudo' => $pseudo,
+ ':timestamp' => time()
+ ));
+ }
+
+ else // L'IP se trouve déjà dans la table, on met juste à jour le timestamp.
+ {
+ $stmt2 = $db->prepare('UPDATE connectes SET timestamp = :timestamp WHERE ip = :ip');
+ $stmt2->execute(array(
+ ':timestamp' => time(),
+ ':ip' => $_SERVER['REMOTE_ADDR']
+ ));
+ }
+
+ }
+
+
+ // -------
+ // ÉTAPE 2 : on supprime toutes les entrées dont le timestamp est plus vieux que 5 minutes.
+
+ // On stocke dans une variable le timestamp qu'il était il y a 5 min :
+ $timestamp_5min = time() - (60 * 5); // (60 * 5 = nombre de secondes écoulées en 5 minutes)
+
+ $stmt3 = $db->query('DELETE FROM connectes WHERE timestamp < ' . $timestamp_5min);
+
+ // -------
+ // ÉTAPE 3 : on compte le nombre d'IP stockées dans la table. C'est le nombre total de personnes connectées.
+ $stmt4 = $db->query('SELECT COUNT(*) AS nbre_entrees FROM connectes');
+ $donnees = $stmt4->fetch();
+
+ // On affiche le nombre total de connectés
+ if ($donnees['nbre_entrees'] < 2) {
+ echo '<li>&rsaquo; <span style="font-weight: bold;">Personne connectée :</span> '.$donnees['nbre_entrees'].'</li>';
+ }
+
+ else {
+ echo '<li>&rsaquo; <span>Personnes connectées :</span> '.$donnees['nbre_entrees'].'</li>';
+ }
+
+ // -------
+ // ETAPE 4 : on affiche si c'est un Visiteur ou un Membre (avec son nom de membre)
+
+ // On cherche le nombre de Visiteurs
+ $stmt5 = $db->query("SELECT pseudo FROM connectes WHERE pseudo = 'Visiteur'");
+ $num = $stmt5->rowCount();
+
+ if($num>0) {
+ $i=0;
+ while($dn2 = $stmt5->fetch()) {
+ $i++;
+ }
+ }
+
+
+ echo '<div style="padding-left: 20px;">';
+ if($num<2) {
+ echo '<li><span><img src="'.SITEURL.'/images/visitor.png" alt="" />&nbsp;'.$num.' visiteur</span></li>';
+ }
+ else {
+ echo '<li><span><img src="'.SITEURL.'/images/visitor.png" alt="" />&nbsp;'.$num.' visiteurs</span></li>';
+ }
+
+ // On cherche le nombre de membres connectés avec leur speduo
+ $stmt6 = $db->query("SELECT pseudo FROM connectes WHERE pseudo != 'Visiteur'");
+ $num1 = $stmt6->rowCount();
+
+ if($num1 >= 2) {
+ echo '<li><span><img src="'.SITEURL.'/images/member-icon.png" alt="" />&nbsp;'.$num1.' membres : ';
+ }
+ elseif($num1 == 0) {
+ echo '<li><span><img src="'.SITEURL.'/images/member-icon.png" alt="" />&nbsp;'.$num1.' membre';
+ }
+ elseif($num1 < 2) {
+ echo '<li><span><img src="'.SITEURL.'/images/member-icon.png" alt="" />&nbsp;'.$num1.' membre : ';
+ }
+
+ $links = array();
+ foreach ($stmt6 as $s) {
+ $links[] = '<a href="'.SITEURL.'/admin/profil.php?membre='.html($s['pseudo']).'" style="text-decoration: none;">'.html($s['pseudo']).'</a>';
+ }
+ echo implode(", ", $links);
+ echo '</span></li>';
+ //}
+
+ //echo '</fieldset>';
+ echo '</div>';
+
+
+ /**** compteur de visites ***/
+ // ETAPE 1 : on vérifie si l'IP se trouve déjà dans la table
+ // Pour faire ça, on n'a qu'à compter le nombre d'entrées dont le champ "ip" est l'adresse ip du visiteur
+ $stmt5 = $db->prepare('SELECT COUNT(*) AS nbre_entrees FROM compteur WHERE ip = :adresseip');
+ $stmt5->execute(array(
+ ':adresseip' => $_SERVER['REMOTE_ADDR']
+ ));
+ $donnees2 = $stmt5->fetch();
+
+ if ($donnees2['nbre_entrees'] == 0) // L'ip ne se trouve pas dans la table, on va l'ajouter
+ {
+ $stmt6 = $db->prepare('INSERT INTO compteur VALUES (:adresseip, :time)');
+ $stmt6->execute(array(
+ ':adresseip' => $_SERVER['REMOTE_ADDR'],
+ ':time' => time()
+ ));
+ }
+
+ else // L'ip se trouve déjà dans la table, on met juste à jour le timestamp
+ {
+ $stmt7 = $db->prepare('UPDATE compteur SET timestamp = :timestamp WHERE ip = :adresseip');
+ $stmt7->execute(array(
+ ':timestamp' => time(),
+ ':adresseip' => $_SERVER['REMOTE_ADDR']
+ ));
+ }
+
+ $jour = date('d');
+ $mois = date('m');
+ $annee = date('Y');
+ $aujourd_hui = mktime(0, 0, 0, $mois, $jour, $annee);
+
+ $stmt8 = $db->prepare('SELECT COUNT(*) AS nbre_entrees FROM compteur WHERE timestamp > :timestamp');
+ $stmt8->execute(array(
+ ':timestamp' => $aujourd_hui
+ ));
+ $donnees3 = $stmt8->fetch();
+
+ echo '<li>&rsaquo; <span>Visites aujourd\'hui :</span> '.$donnees3['nbre_entrees'].'</li>';
+
+ $stmt9 = $db->query('SELECT COUNT(*) AS nbre_entrees FROM compteur');
+ $donnees4 = $stmt9->fetch();
+ echo '<li>&rsaquo; <span>Visites totales :</span> ' . $donnees4['nbre_entrees'].'</li>';
+
+ /**** Fin compteur de visites ****/
+ ?>
+
+ </ul>
+ </fieldset>
+
+ <fieldset>
+ <legend style="font-size: 14px;">Tracker</legend>
+ <ul>
+ <?php
+ $stmt = $db->query('SELECT info_hash, sum(completed) completed, sum(leechers) leechers, sum(seeders) seeders, sum(leechers or seeders) torrents FROM xbt_files');
+ $result = $stmt->fetch();
+
+ $result['peers'] = $result['leechers'] + $result['seeders'];
+
+ echo '<table class="table-style-two">';
+
+ echo '<tr><td>Torrents téléchargés : </td><td style="text-align: center;">'. $result['completed']. '</td></tr>';
+ echo '<tr><td>Clients : </td><td style="text-align: center;">'. $result['peers']. '</td></tr>';
+
+ if ($result['peers'])
+ {
+ printf('<tr><td>Leechs : </td><td style="text-align: center;">%d <span style="font-size:7pt;">(%d %%)</span>', $result['leechers'], $result['leechers'] * 100 / $result['peers'], '</td></tr>');
+ printf('<tr><td>Seeds : </td><td style="text-align: center;">%d <span style="font-size:7pt;">(%d %%)</span>', $result['seeders'], $result['seeders'] * 100 / $result['peers'], '</td></tr>');
+ }
+
+ echo '<tr><td>Torrents actifs : </td><td style="text-align: center;">'. $result['torrents']. '</td></tr>';
+
+ //$nbr = mysql_query("SELECT id_torr FROM torrents");
+ //$nbrtorrents = mysql_num_rows($nbr);
+ $stmt = $db->query('SELECT postID FROM blog_posts_seo');
+ $nbrtorrents =$stmt->rowCount();
+
+ printf('<tr><td>Torrents total : </td><td style="text-align: center;">%d', $nbrtorrents ,'</td></tr>');
+
+ //$res = mysql_query("select sum(downloaded) as down, sum(uploaded) as up from xbt_users");
+ //$row = mysql_fetch_array($res);
+ $stmt = $db->query('SELECT sum(downloaded) as down, sum(uploaded) as up FROM xbt_users');
+ $row = $stmt->fetch();
+
+ $dled=makesize($row['down']);
+ $upld=makesize($row['up']);
+ $traffic=makesize($row['down'] + $row['up']);
+
+ printf('<tr><td>Download total : </td><td style="text-align: center;">'. $dled. '</td></tr>');
+ printf('<tr><td>Upload total : </td><td style="text-align: center;">'. $upld. '</td></tr>');
+ printf('<tr><td>Trafic total : </td><td style="text-align: center;">'. $traffic. '</td></tr>');
+
+ echo '</table>';
+ ?>
+ </ul>
+ </fieldset>
+ </fieldset>
+</li>
+
+<li>
+ <fieldset>
+ <legend><h4><span>Liens web</span></h4></legend>
+ <ul>
+ <li>&rsaquo; <a style="text-decoration: none;" href="http://www.mumbly58.fr">mumbly58.fr : blog geek et Libre</a></li>
+ <li>&rsaquo; <a style="text-decoration: none;" href="https://www.citizenz.info">CitizenZ : blog Net & Sécurité</a></li>
+ </ul>
+ </fieldset>
+</li>
+
+</ul>
+</div>