login  Naam:   Wachtwoord: 
Registreer je!
 Scripts:

Scripts > PHP > Snippets > Bericht statistieken in phpBB v1.1

Bericht statistieken in phpBB v1.1

Auteur: LuckyLuke - 04 september 2004 - 16:00 - Gekeurd door: Dennisvb - Hits: 2987 - Aantal punten: (0 stemmen)




Een klein scriptje voor phpBB 

Dit script kijkt in welke fora je allemaal hebt gepost en hoeveel inclusief percentage 

Dit script hoef je alleen maar in je forum root te stoppen 

V1.1:
Sorteert nu op naam 

Code:
  1. <html>
  2.  
  3. <head>
  4. <title>Waar heb jij gepost?</title>
  5. <style type="text/css">
  6. body {
  7. background-color: #ECF2F5
  8. scrollbar-face-color: {T_TR_COLOR2};
  9. scrollbar-highlight-color: {T_TD_COLOR2};
  10. scrollbar-shadow-color: {T_TR_COLOR2};
  11. scrollbar-3dlight-color: {T_TR_COLOR3};
  12. scrollbar-arrow-color: {T_BODY_LINK};
  13. scrollbar-track-color: {T_TR_COLOR1};
  14. scrollbar-darkshadow-color: {T_TH_COLOR1};
  15. }
  16. .10px {
  17. font-size: 12px;
  18. }
  19. </style>
  20.  
  21. </head>
  22.  
  23. <body>
  24.  
  25. <?php
  26. echo "<font face='verdana' size='2'>";
  27. include("config.php");
  28. mysql_connect($dbhost, $dbuser, $dbpasswd);
  29. mysql_select_db($dbname);
  30. if(isset($_POST['submit'])) {
  31. $sql = mysql_query("SELECT * FROM phpbb_users WHERE user_id='".$_POST['naam']."'");
  32. $aantal_users = mysql_num_rows($sql);
  33. if($aantal_users == 0) {
  34. die("Die user bestaat niet");
  35. }
  36. $sql2 = mysql_query("SELECT forum_id FROM phpbb_forums ORDER BY forum_id DESC LIMIT 1");
  37. $laatste_id = mysql_fetch_object($sql2);
  38. $user = mysql_fetch_object($sql);
  39. $forum_id = 1; ?>
  40. <font size="4">Posts stats</font><br>
  41. <font size="3">Waar en hoeveel heb jij gepost?<br></font>
  42. <font class="10px">Statistieken voor <? echo $user->username; ?></font><br><br>
  43. <font size="2">
  44. <table border="0" width="90%" class="10px">
  45. <tr class="10px">
  46. <td width="50%" class="10px"><b>Forum</b></td>
  47. <td width="20%" class="10px"><b>Berichten</b></td>
  48. <td width="20%" class="10px"><b>Percentage</b><td>
  49. </tr>
  50. </table><hr><table border="0" width="90%" class="10px"> <?
  51. if($user->user_posts == 0) {
  52. die("Geen berichten");
  53. }
  54. while($forum_id <= $laatste_id->forum_id) {
  55. $sql3 = mysql_query("SELECT * FROM phpbb_posts WHERE poster_id='".$user->user_id."' AND forum_id='".$forum_id."'");
  56. $aantal_berichten = mysql_num_rows($sql3);
  57. $sql4 = mysql_query("SELECT * FROM phpbb_forums WHERE forum_id='".$forum_id."'");
  58. $forum = mysql_fetch_object($sql4);
  59. $percentage = round($aantal_berichten / $user->user_posts * 100, 2);
  60. if($aantal_berichten != 0) {
  61. ?>
  62. <tr class="10px">
  63. <td width="50%" class="10px"><? echo $forum->forum_name; ?></td>
  64. <td width="20%" class="10px"><? echo $aantal_berichten; ?></td>
  65. <td width="20%" class="10px"><? echo $percentage; ?>%<td>
  66. </tr>
  67. </font>
  68. <?
  69. }
  70. $forum_id++;
  71. }
  72. ?>
  73. </table>
  74. <hr>
  75. <table border="0" width="90%" class="10px">
  76. <tr class="10px">
  77. <td width="50%" align="right" class="10px">Totaal:</td>
  78. <td width="20%" class="10px"><? echo $user->user_posts; ?></td>
  79. <td width="20%" class="10px"><? echo "100%"; ?><td>
  80. </tr></table><br>
  81. <font size="2" class="10px"><center>&copy 2004 Lucas van Dijk</center></font>
  82. <?
  83. } else {
  84. $sql = mysql_query("SELECT * FROM phpbb_users ORDER BY user_id DESC LIMIT 1");
  85. $laatste_id = mysql_fetch_assoc($sql);
  86. ?>
  87. <FORM action="posts_stats.php" method="POST">
  88. Selecteer user:<br>
  89. <SELECT name="naam">
  90. <?
  91. $sql = mysql_query("SELECT * FROM phpbb_users where user_id !=-1 ORDER BY username ASC");
  92. $id = 0;
  93. while($id != $laatste_id[user_id]) {
  94. $user_id = mysql_result($sql, $id, "user_id");
  95. $username = mysql_result($sql, $id, "username");
  96. echo "<option value=\"".$user_id."\">".$username."</option>";
  97. $id++;
  98. }
  99. ?>
  100. </SELECT>
  101. <br>
  102. <input type="submit" value="Ok" name="submit">
  103. </form>
  104. <? }
  105. echo "</font>"; ?>
  106.  
  107. </body>
  108.  
  109. </html>
Download code! Download code (.txt)

 Bekijk een voorbeeld van dit script!
 Stemmen
Niet ingelogd.

 Reacties
Post een reactie
Lees de reacties (2)
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.024s