Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.02 KB | None | 0 0
  1.  
  2. class WBBReader{
  3.  
  4. public function databaseConnection($host, $user, $password, $dbname){
  5. @mysql_connect($host, $user, $password)
  6. or die('Verbindung zur Datenbank schlug fehl!
  7. <br/>&Uuml;berpr&uuml;fen sie ihre <strong>MySQL-Zugangsdaten</strong>!
  8. <br/>Support finden sie <a href="http://jenso.webdiggi.de">hier</a>!');
  9. @mysql_select_db($dbname)
  10. or die('Die Verbindung mit der gewü&uuml;schten Datenbank schlug fehl!
  11. <br/>&Uuml;berpr&uuml;fen sie ihre <strong>MySQL-Zugangsdaten</strong> und den Namen der Datenbank!
  12. <br/>Support finden sie <a href="http://jenso.webdiggi.de">hier</a>!');
  13. }
  14.  
  15. public function getLastPosts($limit, $excludedBoards)
  16. {
  17. //Query:
  18.  
  19. $sql_lastPosts = " SELECT *
  20. FROM wbb2_thread
  21. WHERE boardID NOT IN (".$excludedBoards.")
  22. ORDER BY lastPostTime DESC
  23. LIMIT ".$limit;
  24.  
  25. //send Query.
  26.  
  27. $result_lastPosts = mysql_query($sql_lastPosts);
  28.  
  29.  
  30.  
  31. //Ausgabe
  32.  
  33. while($post = mysql_fetch_assoc($result_lastPosts))
  34. {
  35.  
  36. $queryID = mysql_query('SELECT userID FROM wcf'.WCF_N.'_user WHERE username = '.$post['username'].'');
  37. $UID = mysql_fetch_array($queryID);
  38. $query32 = mysql_query('SELECT * FROM wcf'.WCF_N.'_user_avatar WHERE userID = '.$post['userID'].'');
  39. $row32 = mysql_fetch_array($query32);
  40.  
  41. $key = substr($row32['fileHash'], 0, 2);
  42.  
  43. echo '<tr>
  44. <td>
  45. <div class="threadIcon" style="width="24px"; height="24px"">';
  46. if (0 == $row32['avatarID']) {
  47. echo '<picture>https://excore-gaming.de/wcf/images/avatars/avatar-default.png"</picture> style="float:left" width=32px height=32px/>';
  48. } else {
  49. //echo '<a href="/forum/user-'.$UID['userID'].'/"><img src="http://excore-gaming.de/wcf/images/avatars/'.$key.'/'.$row32['avatarID'].'-'.$row32['fileHash'].'.'.$row32['avatarExtension'].'" style="float:left" width=32px height=32px /></a>';
  50. echo '<picture>https://excore-gaming.de/wcf/images/avatars/'.$key.'/'.$row32['avatarID'].'-'.$row32['fileHash'].'.'.$row32['avatarExtension'].'</picture>" style="float:left" width=32px height=32px />';
  51. }
  52. echo' </div>
  53. <div style="display:inline;">
  54. <nova_link><a href="http://excore-gaming.de/index.php/Thread/'.$post['threadID'].'" float=left></nova_link>
  55. <span class="prefix">
  56. <strong>
  57. '.utf8_encode($post['prefix']).'
  58. </strong>
  59. </span>
  60. <span id=Topic_Name>'.utf8_encode($post['topic']).'</span>
  61. </a>
  62. </div>
  63.  
  64. <div class="threadInfo" style="display:inline;">';
  65.  
  66. echo' </div>
  67. </td>
  68. <td>
  69. <div id=LP_Link class="lastPostInfo"><a href="http://excore-gaming.de/index.php/Thread/'.$post['threadID'].'"></a><span id=Time_LP class="smallFont">';
  70.  
  71. echo "".$post['replies']."";
  72. echo "<poster>".$post['username']."</poster><timer>".gmdate("d.m.Y",$post['time'])."</timer>";
  73.  
  74. echo'</span></div>
  75. </td>';
  76. echo'
  77. </tr>';
  78.  
  79. }
  80. }
  81.  
  82. public function getWIO()
  83. {
  84. //Queries:
  85.  
  86. $sql_membersCount = 'SELECT count(userID)
  87. FROM wcf'.WCF_N.'_session
  88. WHERE UNIX_TIMESTAMP() - lastactivitytime < 900
  89. AND username != ""
  90. AND userID != 0';
  91. $sql_guestsCount = 'SELECT count(userID)
  92. FROM wcf'.WCF_N.'_session
  93. WHERE UNIX_TIMESTAMP() - lastactivitytime < 900
  94. AND username = ""';
  95. $sql_robotsCount = 'SELECT count(userID)
  96. FROM wcf'.WCF_N.'_session
  97. WHERE UNIX_TIMESTAMP() - lastactivitytime < 900
  98. AND username != ""
  99. AND userID = 0';
  100. $sql_members = 'SELECT * FROM wcf'.WCF_N.'_session
  101. WHERE UNIX_TIMESTAMP() - lastactivitytime < 900
  102. AND username != ""
  103. AND userID != 0';
  104. //send Queries:
  105.  
  106. $members = mysql_fetch_assoc(mysql_query($sql_membersCount)) or die(mysql_error());
  107. $guests = mysql_fetch_assoc(mysql_query($sql_guestsCount)) or die(mysql_error());
  108. $robot = mysql_fetch_assoc(mysql_query($sql_robotsCount)) or die(mysql_error());
  109. $result_members = mysql_query($sql_members);
  110.  
  111. //Ausgabe:
  112.  
  113. echo '<div class="wio">
  114. <div class="headline_wio">
  115. <h3>Zur Zeit sind '.(intval($members['count(userID)']) + intval($guests['count(userID)'])).' Benutzer online.</h3>
  116. </div>
  117. <div class="body_wio">
  118. '.intval($members['count(userID)']).' Mitglieder und '.intval($guests['count(userID)']).' G&auml;ste
  119. </div>
  120. <div class="users_wio">';
  121. if(mysql_num_rows($result_members) != 0)
  122. {
  123. while($users = mysql_fetch_assoc($result_members))
  124. {
  125. echo '<a href="http://excore-gaming.de/index.php?page=User&amp;userID='.$users['userID'].'">
  126. <span class="username">
  127. '.$users['username'].'
  128. </span>
  129. </a>';
  130. }
  131. }
  132. else
  133. {
  134. echo 'Derzeit ist kein registriertes Mitglied im Forum unterwegs.';
  135. }
  136.  
  137. echo' </div>
  138. </div>';
  139.  
  140. }
  141.  
  142.  
  143. public function getWBBStats()
  144. {
  145. //Queries:
  146.  
  147. $sql_usersCount = 'SELECT COUNT(*) AS users FROM wcf'.WCF_N.'_user';
  148. $sql_threadCount = 'SELECT COUNT(*) AS threads FROM wbb'.WCF_N.'_thread';
  149. $sql_postCount = 'SELECT COUNT(*) AS posts FROM wbb'.WCF_N.'_post';
  150. $sql_newUser = 'SELECT userID, username FROM wcf'.WCF_N.'_user ORDER BY registrationDate DESC LIMIT 1';
  151. $sql_installDate = 'SELECT optionValue FROM wcf'.WCF_N.'_option WHERE optionName = "install_date"';
  152.  
  153. //Send Queries:
  154.  
  155. $usersCount = mysql_fetch_assoc(mysql_query($sql_usersCount)) or die(mysql_error());
  156. $threads = mysql_fetch_assoc(mysql_query($sql_threadCount)) or die (mysql_error());
  157. $posts = mysql_fetch_assoc(mysql_query($sql_postCount)) or die (mysql_error());
  158. $newUser = mysql_fetch_assoc(mysql_query($sql_newUser)) or die (mysql_error());
  159. $installDate = mysql_fetch_assoc(mysql_query($sql_installDate)) or die (mysql_error());
  160.  
  161. //Berechnungen:
  162.  
  163. //Alter in Tagen ermitteln
  164. $age = (time() - $installDate['optionValue']) / (3600*24);
  165. //Beiträge pro Tag
  166. $postsPerDay = round($posts['posts'] / $age, 2);
  167.  
  168. }
  169.  
  170. }
  171. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement