diff options
author | citizenz7 <citizenz7@protonmail.com> | 2017-04-20 18:50:55 +0200 |
---|---|---|
committer | citizenz7 <citizenz7@protonmail.com> | 2017-04-20 18:50:55 +0200 |
commit | 5fd9fa480f302902328b81f912dd67ce378284f8 (patch) | |
tree | 66234843ae2857fda12442e4f7577c527d48977c /Html/admin/profil.php | |
parent | ebe731862c7c741171138b1083906f391fc35aff (diff) | |
download | freetorrent-5fd9fa480f302902328b81f912dd67ce378284f8.tar.xz freetorrent-5fd9fa480f302902328b81f912dd67ce378284f8.zip |
V.1.4.6
Diffstat (limited to '')
-rw-r--r-- | Html/admin/profil.php | 619 |
1 files changed, 619 insertions, 0 deletions
diff --git a/Html/admin/profil.php b/Html/admin/profil.php new file mode 100644 index 0000000..97d7fbb --- /dev/null +++ b/Html/admin/profil.php @@ -0,0 +1,619 @@ +<?php +require_once('../includes/config.php'); + +//Si pas connecté OU si le profil n'appartient pas au membre = pas d'accès +if(!$user->is_logged_in()) { + header('Location: login.php'); +} + +if(!isset($_GET['membre'])) { + header('Location: ./'); +} + +$stmt = $db->prepare('SELECT * FROM blog_members WHERE username = :username'); +$stmt->bindValue(':username', $_GET['membre'], PDO::PARAM_STR); +$stmt->execute(); +$row = $stmt->fetch(); + +if($row['username'] == '') { + header('Location: '.SITEURL.'/membres.php?action=noexistmember'); +} + +// Il n'y a pas de page profil pour le compte Visiteur +if($_GET['membre'] == 'Visiteur') { + header('Location: ./'); +} + + +// C'est parti !!! +else { + +// titre de la page +$pagetitle = 'Page Profil de '.html($_GET['membre']); + +include_once('../includes/header.php'); +?> + +<body> +<div id="container"> + + <?php + include_once('../includes/header-logo.php'); + include_once('../includes/nav.php'); + ?> + + + <div id="body"> + <div id="content"> + + <?php + //On affiche le résultat de l'édition du profil + if(isset($_GET['action'])){ + echo '<div class="alert-msg rnd8 success">Votre profil a été mis à jour !</div>'; + } + + //On affiche le résultat de l'envoi de message interne + if(isset($_GET['message'])){ + echo '<div class="alert-msg rnd8 success">Le message a été envoyé !</div>'; + } + + + try { + $stmt = $db->prepare('SELECT * FROM blog_members,xbt_users WHERE blog_members.memberID = xbt_users.uid AND username = :username'); + $stmt->bindValue(':username', $_GET['membre'], PDO::PARAM_STR); + $stmt->execute(); + $row = $stmt->fetch(); + } + catch(PDOException $e) { + echo $e->getMessage(); + } + ?> + + + <?php + if(isset($_SESSION['username']) && $_SESSION['username'] != $_GET['membre']) { + ?> + + <table> + <tr> + <td>ID de membre : </td><td><?php echo html($row['memberID']); ?></td> + <?php + if(empty($row['avatar'])) { + ?> + <td rowspan="6" style="text-align: center;"><img style="width:125px; height:125px;" src="<?php echo SITEURL; ?>/images/avatars/avatar-profil.png" alt="Pas d'avatar pour <?php echo html($row['username']); ?>" /></td> + <?php } + else { + ?> + <td rowspan="7" style="text-align: center;"><img style="width:125px; height:125px;" src="<?php echo SITEURL; ?>/images/avatars/<?php echo html($row['avatar']); ?>" alt="Avatar de <?php echo html($row['username']); ?>" /></td> + <?php } ?> + </tr> + <tr><td>Pseudo :</td><td style="font-weight: bold;"><?php echo html($row['username']); ?> <a style="text-decoration: none;" href="<?php echo SITEURL; ?>/messages_envoyer.php?destid=<?php echo html($row['memberID']); ?>&destuser=<?php echo html($row['username']); ?>"> <img style="vertical-align: text-bottom;" src="<?php echo SITEURL; ?>/images/Email-icon.png"></a> + <?php + if($row['memberID'] == 1) { + //echo '<span style="font-weight: bold; color: green;"> [ Webmaster ]</span> | Jabber : mumbly_58 AT jabber.fr'; + echo '<span style="color: green; font-size: 9pt;"> [ Webmaster ] </span><span style="font-size: 9pt;"> [ <a href="mailto:mumbly_58@jabber.fr">Jabber</a> ]</span>'; + } + ?> + </td></tr> + + <tr><td>Date d'inscription : </td><td> + + <?php + sscanf($row['memberDate'], "%4s-%2s-%2s %2s:%2s:%2s", $annee, $mois, $jour, $heure, $minute, $seconde); + echo 'Le '.$jour.'-'.$mois.'-'.$annee.' à '.$heure.':'.$minute.':'.$seconde; + ?> + + </td></tr> + + <tr><td>Envoyé :</td><td><?php echo makesize($row['uploaded']); ?></td></tr> + <tr><td>Téléchargé :</td><td><?php echo makesize($row['downloaded']); ?></td></tr> + + <?php + //Peer Ratio + if (intval($row["downloaded"])>0) { + $ratio=number_format($row["uploaded"]/$row["downloaded"],2); + } + else { + $ratio='∞'; + } + ?> + + <tr><td>Ratio de partage :</td><td><?php echo $ratio; ?></td></tr> + </table> + + + <!-- Historique téléchargements --> +<table> + <tr><td colspan="6"><h3 id="historique">Ses Téléchargements :</h3></td></tr> + <?php + $pages = new Paginator('5','d'); + $stmt = $db->prepare('SELECT fid FROM xbt_files_users WHERE uid = :uid'); + $stmt->bindValue(':uid', $row['memberID'], PDO::PARAM_INT); + $stmt->execute(); + + $pages->set_total($stmt->rowCount()); + + + // Tri de colonnes + $tri = 'postTitle'; + $ordre = 'DESC'; + + if(isset($_GET['tri'])) { + // Les valeurs authorisee + $columns = array('postTitle','postDate','postTaille','seeders','leechers','xf.completed'); + $direction = array('ASC','DESC','asc','desc'); + if(in_array($_GET['tri'],$columns)){ //Une des valeurs authorisee, on la set. Sinon ca sera la veleurs par defaut fixee au dessus + $tri = htmlentities($_GET['tri']); + } + if(isset($_GET['ordre']) and in_array($_GET['ordre'],$direction)){ //Une des valeurs authorisee, on la set. Sinon ca sera la veleurs par defaut fixee au dessus + $ordre = htmlentities($_GET['ordre']); + } + } + + $stmtorr1 = $db->prepare(' + SELECT * FROM xbt_files_users xfu + LEFT JOIN blog_posts_seo bps ON bps.postID = xfu.fid + LEFT JOIN xbt_files xf ON xf.fid = bps.postID + WHERE xfu.uid = :uid + ORDER BY '.$tri.' '.$ordre.' '.$pages->get_limit() + ); + $stmtorr1->execute(array( + ':uid' => $row['memberID'] + )); + ?> + <tr> + <th style="width: 420px;"><a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=postTitle&ordre=desc">↑</a>Nom<a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=postTitle&ordre=asc">↓</a></th> + <th><a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=postDate&ordre=desc">↑</a>Ajouté<a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=postDate&ordre=asc">↓</a></th> + <th><a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=postTaille&ordre=desc">↑</a>Taille<a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=postTaille&ordre=asc">↓</a></th> + <th style="text-align: center;"><a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=seeders&ordre=desc">↑</a>S<a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=seeders&ordre=asc">↓</a></th> + <th style="text-align: center;"><a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=leechers&ordre=desc">↑</a>L<a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=leechers&ordre=asc">↓</a></th> + <th style="text-align: center;"><a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=xf.completed&ordre=desc">↑</a>T<a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=xf.completed&ordre=asc">↓</a></th> + </tr> + + <?php + while($rowtorr = $stmtorr1->fetch()) { + ?> + <tr> + <td style="font-weight: bold;"> + <a style="text-decoration: none;" href="<?php echo SITEURL; ?>/<?php echo $rowtorr['postSlug']; ?>"><?php echo $rowtorr['postTitle'];?></a> + </td> + <?php + sscanf($rowtorr['postDate'], "%4s-%2s-%2s %2s:%2s:%2s", $annee, $mois, $jour, $heure, $minute, $seconde); + echo '<td>'.$jour.'-'.$mois.'-'.$annee.'</td>'; + ?> + <td><?php echo makesize($rowtorr['postTaille']); ?></td> + <td style="text-align: center; font-weight: bold;"><a style="text-decoration: none;" href="../peers.php?hash=<?php echo $rowtorr['postHash']; ?>"><?php echo $rowtorr['seeders']; ?></a></td> + <td style="text-align: center; font-weight: bold;"><a style="text-decoration: none;" href="../peers.php?hash=<?php echo $rowtorr['postHash']; ?>"><?php echo $rowtorr['leechers']; ?></a></td> + <td style="text-align: center;"><?php echo $rowtorr['completed']; ?></td> + </tr> + <?php } ?> + +</table> +<!-- //historique téléchargements --> + +<?php + echo '<div style="text-align: center;">'; + //echo $pages->page_links('?membre='.$row['username'].'&'); + echo $pages->page_links('?membre='.$row['username'].'&tri='.$tri.'&ordre='.$ordre.'&'); + echo '</div>'; +?> + +<br /> + + +<!-- Historique uploads --> +<table> + <tr><td colspan="6"><h3 id="historique">Ses Uploads :</h3></td></tr> + <?php + $pages = new Paginator('5','u'); + $stmt = $db->prepare('SELECT postID FROM blog_posts_seo WHERE postAuthor = :postAuthor'); + //$stmt = $db->prepare('SELECT fid FROM xbt_files_users WHERE uid = :uid'); + $stmt->execute(array( + ':postAuthor' => $row['username'] + )); + $pages->set_total($stmt->rowCount()); + + /* + // TRI + if(isset($_GET['tri'])) { + $tri = htmlentities($_GET['tri']); + } + else { + $tri = 'postID'; + } + if(isset($_GET['ordre'])) { + $ordre = htmlentities($_GET['ordre']); + } + else { + $ordre = 'DESC'; + } + */ + + if(isset($_GET['tri'])) { + // Les valeurs authorisee + $columns = array('postTitle','postDate','postTaille','seeders','leechers','xf.completed'); + $direction = array('ASC','DESC','asc','desc'); + if(in_array($_GET['tri'],$columns)){ //Une des valeurs authorisee, on la set. Sinon ca sera la veleurs par defaut fixee au dessus + $tri = htmlentities($_GET['tri']); + } + if(isset($_GET['ordre']) and in_array($_GET['ordre'],$direction)){ //Une des valeurs authorisee, on la set. Sinon ca sera la veleurs par defaut fixee au dessus + $ordre = htmlentities($_GET['ordre']); + } + } + + $stmtorr2 = $db->prepare(' + SELECT * FROM blog_posts_seo + LEFT JOIN xbt_files xf ON xf.fid = blog_posts_seo.postID + WHERE blog_posts_seo.postAuthor = :postAuthor + ORDER BY '.$tri.' '.$ordre.' '.$pages->get_limit() + ); + $stmtorr2->execute(array( + ':postAuthor' => $row['username'] + )); + ?> + <tr> + <th style="width: 420px;"><a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=postTitle&ordre=desc">↑</a>Nom<a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=postTitle&ordre=asc">↓</a></th> + <th><a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=postDate&ordre=desc">↑</a>Ajouté<a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=postDate&ordre=asc">↓</a></th> + <th><a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=postTaille&ordre=desc">↑</a>Taille<a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=postTaille&ordre=asc">↓</a></th> + <th style="text-align: center;"><a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=seeders&ordre=desc">↑</a>S<a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=seeders&ordre=asc">↓</a></th> + <th style="text-align: center;"><a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=leechers&ordre=desc">↑</a>L<a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=leechers&ordre=asc">↓</a></th> + <th style="text-align: center;"><a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=xf.completed&ordre=desc">↑</a>T<a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=xf.completed&ordre=asc">↓</a></th> + </tr> + + <?php + while($rowtorr2 = $stmtorr2->fetch()) { + ?> + <tr> + <td style="font-weight: bold;"> + <a style="text-decoration: none;" href="<?php echo SITEURL; ?>/<?php echo $rowtorr2['postSlug']; ?>"><?php echo $rowtorr2['postTitle'];?></a> + </td> + <?php + sscanf($rowtorr2['postDate'], "%4s-%2s-%2s %2s:%2s:%2s", $annee, $mois, $jour, $heure, $minute, $seconde); + echo '<td>'.$jour.'-'.$mois.'-'.$annee.'</td>'; + ?> + <td><?php echo makesize($rowtorr2['postTaille']); ?></td> + <td style="text-align: center; font-weight: bold;"><a style="text-decoration: none;" href="../peers.php?hash=<?php echo $rowtorr2['postHash']; ?>"><?php echo $rowtorr2['seeders']; ?></a></td> + <td style="text-align: center; font-weight: bold;"><a style="text-decoration: none;" href="../peers.php?hash=<?php echo $rowtorr2['postHash']; ?>"><?php echo $rowtorr2['leechers']; ?></a></td> + <td style="text-align: center;"><?php echo $rowtorr2['completed']; ?></td> + </tr> + <?php } ?> + +</table> +<!-- //historique téléchargements --> + +<?php + echo '<div style="text-align: center;">'; + echo $pages->page_links('?membre='.$row['username'].'&tri='.$tri.'&ordre='.$ordre.'&'); + echo '</div>'; +?> + +<br /> + + + <?php + }// fin if($_SESSION) + + + else { + ?> + + <span style="font-size: 15pt; font-weight: bold;"> + Profil membre de : <?php echo $row['username']; ?> + </span> + + <span style="font-size: 9pt;">[ <a style="text-decoration: none;" href="<?php echo SITEURL; ?>/admin/edit-profil.php?membre=<?php echo $row['username']; ?>"><img style="vertical-align: text-bottom;" src="<?php echo SITEURL; ?>/images/user.png" /> Editer votre profil</a></span> + | + <span style="font-size: 9pt;"><a style="text-decoration: none;" href="<?php echo SITEURL; ?>/admin/messagerie.php?membre=<?php echo $row['username']; ?>"><img style="vertical-align: text-bottom;" src="<?php echo SITEURL; ?>/images/Email-icon.png" /> Messagerie interne</a> ]</span> + + <br /><br /> + + <table> + <tr> + <td>ID de membre : </td><td><?php echo $row['memberID']; ?></td> + + <?php + if(empty($row['avatar'])) { + ?> + <td rowspan="7" stule="text-align: center;"><img style="width: 125px; height: 125px;" src="<?php echo SITEURL; ?>/images/avatars/avatar-profil.png" alt="Pas d'avatar pour <?php echo $row['username']; ?>" /></td> + <?php } + else { + ?> + <td rowspan="7" style="text-align: center;"><img style="width: 125px; height: 125px;" src="<?php echo SITEURL; ?>/images/avatars/<?php echo $row['avatar']; ?>" alt="Avatar de <?php echo $row['username']; ?>" /></td> + <?php } ?> + </tr> + <tr><td>E-mail : </td><td><?php echo $row['email']; ?></td></tr> + <tr><td>Pid : </td><td><?php echo $row['pid']; ?></td></tr> + <tr><td>Date d'inscription : </td><td> + + <?php + sscanf($row['memberDate'], "%4s-%2s-%2s %2s:%2s:%2s", $annee, $mois, $jour, $heure, $minute, $seconde); + echo 'Le '.$jour.'-'.$mois.'-'.$annee.' à '.$heure.':'.$minute.':'.$seconde; + ?> + + </td></tr> + <tr><td>Envoyé :</td><td><?php echo makesize($row['uploaded']); ?></td></tr> + <tr><td>Téléchargé :</td><td><?php echo makesize($row['downloaded']); ?></td></tr> + + <?php + //$ratio = $row['uploaded'] / $row['downloaded']; + //$ratio = number_format($ratio, 2); + if (intval($row["downloaded"])>0) { + $ratio=number_format($row["uploaded"]/$row["downloaded"],2); + } + else { + $ratio='∞'; + } + ?> + + <tr><td>Ratio de partage :</td><td><?php echo $ratio; ?></td></tr> + + </table> + +<br /> + + + +<!-- Historique téléchargements --> +<table> + <tr><td colspan="6"><h3 id="historique">Mes Téléchargements :</h3></td></tr> + <?php + $pages = new Paginator('5','d'); + $stmt = $db->prepare('SELECT fid FROM xbt_files_users WHERE uid = :uid'); + $stmt->execute(array( + ':uid' => $row['memberID'] + )); + + $pages->set_total($stmt->rowCount()); + + /* + // TRI + if(isset($_GET['tri'])) { + $tri = htmlentities($_GET['tri']); + } + else { + $tri = 'postID'; + } + if(isset($_GET['ordre'])) { + $ordre = htmlentities($_GET['ordre']); + } + else { + $ordre = 'DESC'; + } + */ + + // Tri de colonnes + $tri = 'postDate'; + $ordre = 'DESC'; + if(isset($_GET['tri'])) { + // Les valeurs authorisee + $columns = array('postTitle','postDate','postTaille','seeders','leechers','xf.completed'); + $direction = array('ASC','DESC','asc','desc'); + if(in_array($_GET['tri'],$columns)){ //Une des valeurs authorisee, on la set. Sinon ca sera la veleurs par defaut fixee au dessus + $tri = htmlentities($_GET['tri']); + } + if(isset($_GET['ordre']) and in_array($_GET['ordre'],$direction)){ //Une des valeurs authorisee, on la set. Sinon ca sera la veleurs par defaut fixee au dessus + $ordre = htmlentities($_GET['ordre']); + } + } + + $stmtorr1 = $db->prepare(' + SELECT * FROM xbt_files_users xfu + LEFT JOIN blog_posts_seo bps ON bps.postID = xfu.fid + LEFT JOIN xbt_files xf ON xf.fid = bps.postID + WHERE xfu.uid = :uid + ORDER BY '.$tri.' '.$ordre.' '.$pages->get_limit() + ); + $stmtorr1->execute(array( + ':uid' => $row['memberID'] + )); + ?> + <tr> + <th style="width: 420px;"><a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=postTitle&ordre=desc">↑</a>Nom<a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=postTitle&ordre=asc">↓</a></th> + <th><a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=postDate&ordre=desc">↑</a>Ajouté<a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=postDate&ordre=asc">↓</a></th> + <th><a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=postTaille&ordre=desc">↑</a>Taille<a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=postTaille&ordre=asc">↓</a></th> + <th style="text-align: center;"><a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=seeders&ordre=desc">↑</a>S<a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=seeders&ordre=asc">↓</a></th> + <th style="text-align: center;"><a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=leechers&ordre=desc">↑</a>L<a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=leechers&ordre=asc">↓</a></th> + <th style="text-align: center;"><a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=xf.completed&ordre=desc">↑</a>T<a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=xf.completed&ordre=asc">↓</a></th> + </tr> + + <?php + while($rowtorr = $stmtorr1->fetch()) { + ?> + <tr> + <td style="font-weight: bold;"> + <a style="text-decoration: none;" href="<?php echo SITEURL; ?>/<?php echo $rowtorr['postSlug']; ?>"><?php echo $rowtorr['postTitle'];?></a> + </td> + <?php + sscanf($rowtorr['postDate'], "%4s-%2s-%2s %2s:%2s:%2s", $annee, $mois, $jour, $heure, $minute, $seconde); + echo '<td>'.$jour.'-'.$mois.'-'.$annee.'</td>'; + ?> + <td><?php echo makesize($rowtorr['postTaille']); ?></td> + <td style="text-align: center; font-weight: bold;"><a style="text-decoration: none;" href="../peers.php?hash=<?php echo $rowtorr['postHash']; ?>"><?php echo $rowtorr['seeders']; ?></a></td> + <td style="text-align: center; font-weight: bold;"><a style="text-decoration: none;" href="../peers.php?hash=<?php echo $rowtorr['postHash']; ?>"><?php echo $rowtorr['leechers']; ?></a></td> + <td style="text-align: center;"><?php echo $rowtorr['completed']; ?></td> + </tr> + <?php } ?> + +</table> +<!-- //historique téléchargements --> + +<?php + echo '<div style="text-align: center;">'; + echo $pages->page_links('?membre='.$row['username'].'&tri='.$tri.'&ordre='.$ordre.'&'); + echo '</div>'; +?> + + + +<!-- Historique uploads --> +<table> + <tr><td colspan="6"><h3 id="historique">Mes Uploads :</h3></td></tr> + <?php + $pages = new Paginator('5','u'); + + // On initialise la variable + $sessionuser = isset($_SESSION['username']) ? $_SESSION['username'] : NULL; + + $stmt = $db->prepare('SELECT postID FROM blog_posts_seo WHERE postAuthor = :postAuthor'); + $stmt->bindValue(':postAuthor',$sessionuser,PDO::PARAM_STR); + $stmt->execute(); + $pages->set_total($stmt->rowCount()); + + + // Tri de colonnes + $tri = 'postDate'; + $ordre = 'DESC'; + + if(isset($_GET['tri'])) { + // Les valeurs authorisee + $columns = array('postTitle','postDate','postTaille','seeders','leechers','xf.completed'); + $direction = array('ASC','DESC','asc','desc'); + if(in_array($_GET['tri'],$columns)){ //Une des valeurs authorisee, on la set. Sinon ca sera la veleurs par defaut fixee au dessus + $tri = htmlentities($_GET['tri']); + } + if(isset($_GET['ordre']) and in_array($_GET['ordre'],$direction)){ //Une des valeurs authorisee, on la set. Sinon ca sera la veleurs par defaut fixee au dessus + $ordre = htmlentities($_GET['ordre']); + } + } + + $stmtorr2 = $db->prepare(' + SELECT * FROM blog_posts_seo + LEFT JOIN xbt_files xf ON xf.fid = blog_posts_seo.postID + WHERE blog_posts_seo.postAuthor = :postAuthor + ORDER BY '.$tri.' '.$ordre.' '.$pages->get_limit() + ); + $stmtorr2->execute(array( + ':postAuthor' => $row['username'] + )); + ?> + <tr> + <th style="width: 420px;"><a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=postTitle&ordre=desc">↑</a>Nom<a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=postTitle&ordre=asc">↓</a></th> + <th><a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=postDate&ordre=desc">↑</a>Ajouté<a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=postDate&ordre=asc">↓</a></th> + <th><a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=postTaille&ordre=desc">↑</a>Taille<a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=postTaille&ordre=asc">↓</a></th> + <th style="text-align: center;"><a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=seeders&ordre=desc">↑</a>S<a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=seeders&ordre=asc">↓</a></th> + <th style="text-align: center;"><a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=leechers&ordre=desc">↑</a>L<a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=leechers&ordre=asc">↓</a></th> + <th style="text-align: center;"><a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=xf.completed&ordre=desc">↑</a>T<a style="color: #fff; text-decoration: none;" href="profil.php?membre=<?php echo $row['username']; ?>&tri=xf.completed&ordre=asc">↓</a></th> + </tr> + + <?php + while($rowtorr2 = $stmtorr2->fetch()) { + ?> + <tr> + <td style="font-weight: bold;"> + <a style="text-decoration: none;" href="<?php echo SITEURL; ?>/<?php echo $rowtorr2['postSlug']; ?>"><?php echo $rowtorr2['postTitle'];?></a> + </td> + <?php + sscanf($rowtorr2['postDate'], "%4s-%2s-%2s %2s:%2s:%2s", $annee, $mois, $jour, $heure, $minute, $seconde); + echo '<td>'.$jour.'-'.$mois.'-'.$annee.'</td>'; + ?> + <td><?php echo makesize($rowtorr2['postTaille']); ?></td> + <td style="text-align: center; font-weight: bold;"><a style="text-decoration: none;" href="../peers.php?hash=<?php echo $rowtorr2['postHash']; ?>"><?php echo $rowtorr2['seeders']; ?></a></td> + <td style="text-align: center; font-weight: bold;"><a style="text-decoration: none;" href="../peers.php?hash=<?php echo $rowtorr2['postHash']; ?>"><?php echo $rowtorr2['leechers']; ?></a></td> + <td style="text-align: center;"><?php echo $rowtorr2['completed']; ?></td> + </tr> + <?php } ?> + +</table> +<!-- //historique téléchargements --> + +<?php + echo '<div style="text-align: center;">'; + //echo $pages->page_links('?membre='.$row['username'].'&'); + echo $pages->page_links('?membre='.$row['username'].'&tri='.$tri.'&ordre='.$ordre.'&'); + echo '</div>'; +?> + +<br /> + + + + + + + +<?php /* ?> + +<!-- Messages internes --> +<?php +$pages = new Paginator('10','m'); +$stmt = $db->prepare('SELECT messages_id FROM blog_messages WHERE messages_id_destinataire = :destinataire'); +$stmt->execute(array( + ':destinataire' => $row['memberID'] + )); +$pages->set_total($stmt->rowCount()); + +// on prépare une requete SQL cherchant le titre, la date, l'expéditeur des messages pour le membre connecté +$stmt = $db->prepare('SELECT blog_messages.messages_titre, blog_messages.messages_date, blog_members.username as expediteur, blog_messages.messages_id as id_message, blog_messages.messages_lu FROM blog_messages, blog_members WHERE blog_messages.messages_id_destinataire = :id_destinataire AND blog_messages.messages_id_expediteur = blog_members.memberID ORDER BY blog_messages.messages_date DESC '.$pages->get_limit()); +$stmt->execute(array( + ':id_destinataire' => $row['memberID'] + )); +?> + +<table> + <tr> + <td colspan="5"> + <h3 id="messages">Mes Messages : + <a style="text-decoration: none;" href="<?php echo SITEURL; ?>/messages_envoyer.php"><input type="button" class="button" value="Envoyer un message à un membre" /></a> + </h3> + </td> + </tr> + <tr> + <th style="width: 150px;">Date</th> + <th>Titre</th> + <th style="width: 120px;">Expéditeur</th> + </tr> + + <?php + while($data = $stmt->fetch()){ + echo '<tr>'; + sscanf($data['messages_date'], "%4s-%2s-%2s %2s:%2s:%2s", $annee, $mois, $jour, $heure, $minute, $seconde); + echo '<td>'.$jour.'-'.$mois.'-'.$annee.' à '.$heure.':'.$minute.':'.$seconde.'</td>'; + echo '<td>'; + if($data['messages_lu'] == 0) { + echo '<img style="vertical-align: text-bottom; width: 16px; height: 16px;" src="'.SITEURL.'/images/envelope-newmail.gif" /> '; + } + echo '<a style="text-decoration: none;" href="'.SITEURL.'/messages_lire.php?id_message='.$data['id_message'].'">'.stripslashes(htmlentities(trim($data['messages_titre']), ENT_QUOTES, "UTF-8")).'</a>'; + echo '</td>'; + echo '<td>'.stripslashes(htmlentities(trim($data['expediteur']), ENT_QUOTES, "UTF-8")).'</td>'; + echo '</tr>'; + } + ?> +</table> + +<?php + echo '<div style="text-align: center;">'; + echo $pages->page_links('?membre='.$row['username'].'&'); + echo '</div>'; +?> + + <br /><br /> + + + + + +<?php */ ?> + + + + + + <?php + }// fin else + ?> + + </div> + + <?php require('../sidebar.php'); ?> + + <div class="clear"></div> + </div> +</div> + +<div id="footer"> + <?php require('../includes/footer.php'); ?> +</div> + +</body> +</html> +<?php } ?> |