Location: PHPKode > projects > H-tracker > blocks/advancestats_block.php
<?
begin_block("Stats");

$date_time = get_date_time(gmtime()-(3600*24)); // the 24hrs is the hours you want listed
$registered = number_format(get_row_count("users"));
$ncomments = number_format(get_row_count("comments"));
$nmessages = number_format(get_row_count("messages"));
$trackers = number_format(get_row_count("announce"));
$ntor = number_format(get_row_count("torrents"));
$totaltoday = number_format(get_row_count("users", "WHERE users.last_access>='$date_time'"));
$regtoday = number_format(get_row_count("users", "WHERE users.added>='$date_time'"));
$todaytor = number_format(get_row_count("torrents", "WHERE torrents.added>='$date_time'"));
$guests = number_format(getguests());
$seeders = get_row_count("peers", "WHERE seeder='yes'");
$leechers = get_row_count("peers", "WHERE seeder='no'");
$members = number_format(get_row_count("users", "WHERE UNIX_TIMESTAMP('" . get_date_time() . "') - UNIX_TIMESTAMP(users.last_access) < 900"));
$totalonline = $members + $guests;

$result = mysql_query("SELECT SUM(downloaded) AS totaldl FROM users"); 
while ($row = mysql_fetch_array ($result)) { 
	$totaldownloaded = $row["totaldl"]; 
} 

$result = mysql_query("SELECT SUM(uploaded) AS totalul FROM users"); 
while ($row = mysql_fetch_array ($result)) { 
	$totaluploaded      = $row["totalul"]; 
}
$localpeers = $leechers+$seeders;

echo "<div align=left>";
echo "<B>Torrents</B>";
echo "<br><small>Tracking:<B> " . $ntor . " Torrents</b></small>";
echo "<br><small>New Today:<B> " . $todaytor . "</b></small>";
echo "<br><small>Trackers:<B> " . $trackers . "</b></small>";
echo "<br /><small>Local Seeders:<b> " . number_format($seeders) . "</b></small>";
echo "<br /><small>Local Leechers:<b> " . number_format($leechers) . "</b></small>";
echo "<br /><small>Local Peers:<b> " . number_format($localpeers) . "</b></small>";
ECHO "<br><small>Downloaded:<B> " . mksize($totaldownloaded) . "</b></small>";
ECHO "<br><small>Uploaded:<B> " . mksize($totaluploaded) . "</b></small>";
echo "<br><br><B>Members</B>";
echo "<br><small>We Have:<B> " . $registered . " Members</b></small>";
echo "<br><small>New Today:<B> " . $regtoday . "</b></small>";
echo "<br><small>Visited Today: <B>" . $totaltoday . "</b></small>";
echo "<br><br><B>Online</B>";
echo "<br><small>Total:<B> " . $totalonline . "</b></small>";
echo "<br><small>Members:<B> " . $members . "</b></small>";
echo "<br><small>Guests:<B> " . $guests . "</b></small>";
echo "<br><small>Comments Posted:<B> " . $ncomments . "</b></small>";
echo "<br><small>Messages Sent:<B> " . $nmessages . "</b></small>";
echo "<br><br></div>";
end_block();
?>
Return current item: H-tracker