Location: PHPKode > projects > WH Community > wh_community/layout/infobox.php
<div id="stat_line">&nbsp;</div>
    <div class="spacer">&nbsp;<img src="images/info.png" alt="Board Statistic"> <strong><?php echo $lang['i_statistic']; ?></strong></div>
    
    <table width="100%">
    <tr><td width="250" valign="top">

    <span class="blue">Forum <?php echo $lang['statistic']; ?>:</span>&nbsp; <?php

    $abfrage = mysql_query("SELECT post_id FROM posts");
    $total = intval(mysql_num_rows($abfrage));
        echo '<strong>' . (int)$total . '</strong> ' . $lang['posts_in'] . ' </strong>';
    
    $abfrage = mysql_query("SELECT topic_id FROM topics");
    $total = intval(mysql_num_rows($abfrage));
        echo '<strong>' . (int)$total . '</strong> ' . $lang['topics'] . ''; ?><br>
        <span class="blue"><?php echo $lang['reg_user']; ?>:</span>&nbsp; <?php
    
    $abfrage = mysql_query("SELECT user_id FROM users");
    $total = intval(mysql_num_rows($abfrage));
        echo '<strong>' . (int)$total . '</strong>';

    ?><br><?php

    echo '<span class="blue">User Online:</span>&nbsp; ';
    
    $table = 'counter';
    $zeit = "900";
    $time = time();
    $zeit = $time-$zeit;
    $sql_online = "SELECT * FROM " . $table . " WHERE timed > '" . $zeit . "'";
    $erg_online = mysql_query($sql_online) OR die(mysql_error());
    $online = mysql_num_rows($erg_online);
    echo '<strong>' . $online . '</strong>';
    
    if(!isset($_SESSION['signed_in'])) {
    
    $sql = "DELETE FROM
    		  online
    	    WHERE
    		  DATE_SUB(NOW(), INTERVAL 5 MINUTE) > session_timed";
    
    mysql_query($sql) OR die(mysql_error());
    
    $sql = "SELECT
    		  COUNT(*) as allon
    	    FROM
    		  online";
    
    $result = mysql_query($sql) OR die(mysql_error());
    $row = mysql_fetch_assoc($result);
    
    echo ' <small>(<strong>' . $row['allon'] . '</strong> ' . $lang['where'] . ' ' . $lang['s_reg'] . ')</small>';
    
        }else{
        
        $sql = "SELECT
        		  COUNT(*) as allon
        	    FROM
        		  online
        	    WHERE
        		  session_ip = '" . $_SERVER['REMOTE_ADDR'] . "'";
        
        $result = mysql_query($sql) OR die(mysql_error());
        $row = mysql_fetch_assoc($result);
    
    if($row['allon']) {
    
    $sql = "UPDATE
    		online
    	SET
    		session_timed = NOW()
    	WHERE
    		session_ip = '" . $_SERVER['REMOTE_ADDR'] . "'";
    
    mysql_query($sql) OR die(mysql_error());
    
        }else{
        
        $sql = "INSERT INTO online
        			(session_ip, session_timed)
        		VALUES
        			('" . $_SERVER['REMOTE_ADDR'] . "', NOW())";
        
        mysql_query($sql) OR die(mysql_error());
        }
    
    $sql = "DELETE FROM
    		  online
    	    WHERE
    		  DATE_SUB(NOW(), INTERVAL 5 MINUTE) > session_timed";
    
    mysql_query($sql) OR die(mysql_error());
    
    $sql = "SELECT
    		  COUNT(*) as allon
    	    FROM
    		  online";
    
    $result = mysql_query($sql) OR die(mysql_error());
    $row = mysql_fetch_assoc($result);
    
    echo ' <small>(<strong>' . $row['allon'] . '</strong> ' . $lang['where'] . ' ' . $lang['s_reg'] . ')</small>';
    }
    
    echo '</td>
          <td valign="top"><span class="blue">' . $lang['latest_users'] . ': </span>&nbsp;';
    
    $query = "SELECT user_id, user_name, user_date FROM users ORDER BY user_id DESC LIMIT 3";
    $result = mysql_query($query) OR die(mysql_error());
    
    if($result > 0) {
    
    while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
    
        echo '<a href="profile.php?user_id=' . $row['user_id'] . '" class="readmore">' . htmlentities($row['user_name'], ENT_QUOTES) . '</a>&nbsp;&nbsp;&nbsp;&nbsp;';
        }
    
    }else{
    
    echo '<strong>' . $lang['no_users'] . '.</strong>';
    }

    ?><br>
    <span class="blue"><?php echo $lang['birthdays_today']; ?>: </span><?php

    $bday = "SELECT
    		     user_id,
    		     user_name,
    		     user_bday
    	     FROM
    		     users
    	     WHERE
    		     DATE_FORMAT(user_bday,'%d-%m') = DATE_FORMAT(CURDATE(),'%d-%m')";
    	
    $resultb = mysql_query($bday) OR die(mysql_error());
    
    if(!$resultb) {
    
    echo '&nbsp;<span class="mod">' . $lang['no_birthdays'] . '</span>';
    
        }else{
        
        if(mysql_num_rows($resultb) == 0) {
        
        echo '&nbsp;<span class="mod">' . $lang['no_birthdays'] . '</span>';
    
    }else{
    
    while($row = mysql_fetch_assoc($resultb)) {
    
        echo '&nbsp;<a href="profile.php?user_id=' . $row['user_id'] . '">' . htmlentities($row['user_name'], ENT_QUOTES) . '</a>&nbsp;&nbsp;';
    
    }}}
    
    $abfrage = mysql_query("SELECT disc_id FROM discussions");
    $total = intval(mysql_num_rows($abfrage));
        echo '<br><span class="blue">' . $lang['discussions'] . ':</span>&nbsp; <strong>' . (int)$total . '</strong> ';
    
    $abfrage = mysql_query("SELECT op_id FROM opinions");
    $total = intval(mysql_num_rows($abfrage));
        echo '<small>(<strong>' . (int)$total . '</strong> ' . $lang['comments'] . ')</small>';

    ?></td>
    </tr>
</table>
Return current item: WH Community