Top posters per forum voor phpBB
Auteur: LuckyLuke - 23 september 2004 - 17:59 - Gekeurd door: Dennisvb - Hits: 2021 - Aantal punten: 4.00 (1 stem)
Weer een klein scriptje voor phpBB
Deze keer haalt het de top posters per een bepaald forum.
Plaats het gewoon in je phpBB map en hij doet het!
|
Code: |
<html>
<head>
<title></title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<font class="font">
<?php
include("config.php");
mysql_connect($dbhost, $dbuser, $dbpasswd);
mysql_select_db($dbname);
if(isset($_GET['forumid'])) {
if(!is_numeric($_GET['forumid'])) {
echo "Het opgeven forum id is niet geldig";
exit;
}
if(isset($_GET['show'])) {
if($_GET['show'] != "") {
if(!is_numeric($_GET['show'])) {
echo "Ingevoerde waarde niet geldig";
exit;
}
}
$limit = $_GET['show'];
}
if(!isset($_GET['show']) || $_GET['show'] == "") {
$limit = 25;
}
$sql = mysql_query("SELECT * FROM phpbb_forums WHERE forum_id='".$_GET['forumid']."'");
$forum_info = mysql_fetch_array($sql);
?>
<font size="4">Top <? echo $limit; ?> per forum</font><br>
<font size="3">Weergeeft de users die de meeste posts hebben in een bepaald forum.</font>
<br><font size="2">Top <? echo $limit; ?> voor het forum <? echo $forum_info['forum_name']; ?></font>
<form action="top_per_forum.php" method="get">
Selecteer forum:<br>
<select name="forumid">
<?
$sql = mysql_query("SELECT * FROM phpbb_forums ORDER BY forum_id ASC");
$sql2 = mysql_query("SELECT * FROM phpbb_forums ORDER BY forum_id DESC LIMIT 1");
$laatste_id = mysql_fetch_array($sql2);
$i = 0;
while($i != $laatste_id['forum_id']) {
$forum_id = mysql_result($sql, $i, "forum_id");
$forum_naam = mysql_result($sql, $i, "forum_name");
if($forum_id == $_GET['forumid']) {
echo "<option value=\"".$forum_id."\" selected>".$forum_naam."</option>";
} else {
echo "<option value=\"".$forum_id."\">".$forum_naam."</option>";
}
$i++;
}
?>
</select><br>
Hoeveel laten zien (optioneel): <input type="text" maxlenght="4" size="5" name="show">
<br>
<input type="submit" value="Ok">
</form>
<?
$query = "SELECT user_id, username, COUNT(post_id)
AS posts
FROM phpbb_users u, phpbb_posts p
WHERE p.poster_id = u.user_id
AND p.forum_id = ".$_GET['forumid']."
GROUP BY user_id
ORDER BY posts
DESC LIMIT ".$limit."";
$sql = mysql_query($query) or die(mysql_error());
echo "<table width='100%' cellspacing='0' cellpadding='0' border=0>
<tr>
<td width='5%' class='font'> </td>
<td width='70%' class='font'>Username</td>
<td width='20%' class='font'>Aantal posts</td></tr></table>
<hr>";
$plaats = 1;
echo "<table width='100%' cellpadding=0 cellspacing=0 border=0>";
while($list = mysql_fetch_array($sql)) {
echo "<tr border='0'><td width='5%' class='font'>".$plaats.".</td>
<td width='75%' class='font'><a href='posts_stats.php?user_id=".$list['user_id']."'>".$list['username']."</a></td>
<td width='20%' class='font'>".$list['posts']."</td></tr>";
$plaats++;
}
echo "</table><hr>";
} else {
?>
<form action="top_per_forum.php" method="get">
Selecteer forum:<br>
<select name="forumid">
<? $sql = mysql_query("SELECT * FROM phpbb_forums ORDER BY forum_id ASC");
$sql2 = mysql_query("SELECT * FROM phpbb_forums ORDER BY forum_id DESC LIMIT 1");
$laatste_id = mysql_fetch_array($sql2);
$i = 0;
while($i != $laatste_id['forum_id']) {
$forum_id = mysql_result($sql, $i, "forum_id");
$forum_naam = mysql_result($sql, $i, "forum_name");
echo "<option value=\"".$forum_id."\">".$forum_naam."</option>";
$i++;
}
?>
</select><br>
Hoeveel laten zien (optioneel): <input type="text" maxlenght="4" size="5" name="show">
<br>
<input type="submit" value="Ok">
</form>
<? } ?>
</font>
</body>
</html>
<html> <head> <title></title> <link rel="stylesheet" href="style.css"> </head> <body> <font class="font"> <?php include("config.php"); if(isset($_GET['forumid'])) { echo "Het opgeven forum id is niet geldig"; } if(isset($_GET['show'])) { if($_GET['show'] != "") { echo "Ingevoerde waarde niet geldig"; } } $limit = $_GET['show']; } if(!isset($_GET['show']) || $_GET['show'] == "") { $limit = 25; } $sql = mysql_query("SELECT * FROM phpbb_forums WHERE forum_id='".$_GET['forumid']."'"); ?> <font size="4">Top <? echo $limit; ?> per forum</font><br> <font size="3">Weergeeft de users die de meeste posts hebben in een bepaald forum.</font> <br><font size="2">Top <? echo $limit; ?> voor het forum <? echo $forum_info['forum_name']; ?></font> <form action="top_per_forum.php" method="get"> Selecteer forum:<br> <select name="forumid"> <? $sql = mysql_query("SELECT * FROM phpbb_forums ORDER BY forum_id ASC"); $sql2 = mysql_query("SELECT * FROM phpbb_forums ORDER BY forum_id DESC LIMIT 1"); $i = 0; while($i != $laatste_id['forum_id']) { if($forum_id == $_GET['forumid']) { echo "<option value=\"".$forum_id."\" selected>".$forum_naam."</option>"; } else { echo "<option value=\"".$forum_id."\">".$forum_naam."</option>"; } $i++; } ?> </select><br> Hoeveel laten zien (optioneel): <input type="text" maxlenght="4" size="5" name="show"> <br> <input type="submit" value="Ok"> </form> <? $query = "SELECT user_id, username, COUNT(post_id) AS posts FROM phpbb_users u, phpbb_posts p WHERE p.poster_id = u.user_id AND p.forum_id = ".$_GET['forumid']." GROUP BY user_id ORDER BY posts DESC LIMIT ".$limit.""; echo "<table width='100%' cellspacing='0' cellpadding='0' border=0> <tr> <td width='5%' class='font'> </td> <td width='70%' class='font'>Username</td> <td width='20%' class='font'>Aantal posts</td></tr></table> <hr>"; $plaats = 1; echo "<table width='100%' cellpadding=0 cellspacing=0 border=0>"; echo "<tr border='0'><td width='5%' class='font'>".$plaats.".</td> <td width='75%' class='font'><a href='posts_stats.php?user_id=".$list['user_id']."'>".$list['username']."</a></td> <td width='20%' class='font'>".$list['posts']."</td></tr>"; $plaats++; } } else { ?> <form action="top_per_forum.php" method="get"> Selecteer forum:<br> <select name="forumid"> <? $sql = mysql_query("SELECT * FROM phpbb_forums ORDER BY forum_id ASC"); $sql2 = mysql_query("SELECT * FROM phpbb_forums ORDER BY forum_id DESC LIMIT 1"); $i = 0; while($i != $laatste_id['forum_id']) { echo "<option value=\"".$forum_id."\">".$forum_naam."</option>"; $i++; } ?> </select><br> Hoeveel laten zien (optioneel): <input type="text" maxlenght="4" size="5" name="show"> <br> <input type="submit" value="Ok"> </form> <? } ?> </font> </body> </html>
Download code (.txt)
|
|
|
Stemmen |
Niet ingelogd. |
|