Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class WBBReader{
- public function databaseConnection($host, $user, $password, $dbname){
- @mysql_connect($host, $user, $password)
- or die('Verbindung zur Datenbank schlug fehl!
- <br/>Überprüfen sie ihre <strong>MySQL-Zugangsdaten</strong>!
- <br/>Support finden sie <a href="http://jenso.webdiggi.de">hier</a>!');
- @mysql_select_db($dbname)
- or die('Die Verbindung mit der gewüüschten Datenbank schlug fehl!
- <br/>Überprüfen sie ihre <strong>MySQL-Zugangsdaten</strong> und den Namen der Datenbank!
- <br/>Support finden sie <a href="http://jenso.webdiggi.de">hier</a>!');
- }
- public function getLastPosts($limit, $excludedBoards)
- {
- //Query:
- $sql_lastPosts = " SELECT *
- FROM wbb2_thread
- WHERE boardID NOT IN (".$excludedBoards.")
- ORDER BY lastPostTime DESC
- LIMIT ".$limit;
- //send Query.
- $result_lastPosts = mysql_query($sql_lastPosts);
- //Ausgabe
- while($post = mysql_fetch_assoc($result_lastPosts))
- {
- $queryID = mysql_query('SELECT userID FROM wcf'.WCF_N.'_user WHERE username = '.$post['username'].'');
- $UID = mysql_fetch_array($queryID);
- $query32 = mysql_query('SELECT * FROM wcf'.WCF_N.'_user_avatar WHERE userID = '.$post['userID'].'');
- $row32 = mysql_fetch_array($query32);
- $key = substr($row32['fileHash'], 0, 2);
- echo '<tr>
- <td>
- <div class="threadIcon" style="width="24px"; height="24px"">';
- if (0 == $row32['avatarID']) {
- echo '<picture>https://excore-gaming.de/wcf/images/avatars/avatar-default.png"</picture> style="float:left" width=32px height=32px/>';
- } else {
- //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>';
- echo '<picture>https://excore-gaming.de/wcf/images/avatars/'.$key.'/'.$row32['avatarID'].'-'.$row32['fileHash'].'.'.$row32['avatarExtension'].'</picture>" style="float:left" width=32px height=32px />';
- }
- echo' </div>
- <div style="display:inline;">
- <nova_link><a href="http://excore-gaming.de/index.php/Thread/'.$post['threadID'].'" float=left></nova_link>
- <span class="prefix">
- <strong>
- '.utf8_encode($post['prefix']).'
- </strong>
- </span>
- <span id=Topic_Name>'.utf8_encode($post['topic']).'</span>
- </a>
- </div>
- <div class="threadInfo" style="display:inline;">';
- echo' </div>
- </td>
- <td>
- <div id=LP_Link class="lastPostInfo"><a href="http://excore-gaming.de/index.php/Thread/'.$post['threadID'].'"></a><span id=Time_LP class="smallFont">';
- echo "".$post['replies']."";
- echo "<poster>".$post['username']."</poster><timer>".gmdate("d.m.Y",$post['time'])."</timer>";
- echo'</span></div>
- </td>';
- echo'
- </tr>';
- }
- }
- public function getWIO()
- {
- //Queries:
- $sql_membersCount = 'SELECT count(userID)
- FROM wcf'.WCF_N.'_session
- WHERE UNIX_TIMESTAMP() - lastactivitytime < 900
- AND username != ""
- AND userID != 0';
- $sql_guestsCount = 'SELECT count(userID)
- FROM wcf'.WCF_N.'_session
- WHERE UNIX_TIMESTAMP() - lastactivitytime < 900
- AND username = ""';
- $sql_robotsCount = 'SELECT count(userID)
- FROM wcf'.WCF_N.'_session
- WHERE UNIX_TIMESTAMP() - lastactivitytime < 900
- AND username != ""
- AND userID = 0';
- $sql_members = 'SELECT * FROM wcf'.WCF_N.'_session
- WHERE UNIX_TIMESTAMP() - lastactivitytime < 900
- AND username != ""
- AND userID != 0';
- //send Queries:
- $members = mysql_fetch_assoc(mysql_query($sql_membersCount)) or die(mysql_error());
- $guests = mysql_fetch_assoc(mysql_query($sql_guestsCount)) or die(mysql_error());
- $robot = mysql_fetch_assoc(mysql_query($sql_robotsCount)) or die(mysql_error());
- $result_members = mysql_query($sql_members);
- //Ausgabe:
- echo '<div class="wio">
- <div class="headline_wio">
- <h3>Zur Zeit sind '.(intval($members['count(userID)']) + intval($guests['count(userID)'])).' Benutzer online.</h3>
- </div>
- <div class="body_wio">
- '.intval($members['count(userID)']).' Mitglieder und '.intval($guests['count(userID)']).' Gäste
- </div>
- <div class="users_wio">';
- if(mysql_num_rows($result_members) != 0)
- {
- while($users = mysql_fetch_assoc($result_members))
- {
- echo '<a href="http://excore-gaming.de/index.php?page=User&userID='.$users['userID'].'">
- <span class="username">
- '.$users['username'].'
- </span>
- </a>';
- }
- }
- else
- {
- echo 'Derzeit ist kein registriertes Mitglied im Forum unterwegs.';
- }
- echo' </div>
- </div>';
- }
- public function getWBBStats()
- {
- //Queries:
- $sql_usersCount = 'SELECT COUNT(*) AS users FROM wcf'.WCF_N.'_user';
- $sql_threadCount = 'SELECT COUNT(*) AS threads FROM wbb'.WCF_N.'_thread';
- $sql_postCount = 'SELECT COUNT(*) AS posts FROM wbb'.WCF_N.'_post';
- $sql_newUser = 'SELECT userID, username FROM wcf'.WCF_N.'_user ORDER BY registrationDate DESC LIMIT 1';
- $sql_installDate = 'SELECT optionValue FROM wcf'.WCF_N.'_option WHERE optionName = "install_date"';
- //Send Queries:
- $usersCount = mysql_fetch_assoc(mysql_query($sql_usersCount)) or die(mysql_error());
- $threads = mysql_fetch_assoc(mysql_query($sql_threadCount)) or die (mysql_error());
- $posts = mysql_fetch_assoc(mysql_query($sql_postCount)) or die (mysql_error());
- $newUser = mysql_fetch_assoc(mysql_query($sql_newUser)) or die (mysql_error());
- $installDate = mysql_fetch_assoc(mysql_query($sql_installDate)) or die (mysql_error());
- //Berechnungen:
- //Alter in Tagen ermitteln
- $age = (time() - $installDate['optionValue']) / (3600*24);
- //Beiträge pro Tag
- $postsPerDay = round($posts['posts'] / $age, 2);
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement