UNIX_TIMESTAMP(NOW()) - (24*60*60)"; $online_now_sql = "SELECT COUNT(user_id) AS online_now FROM gforum_User WHERE user_last_seen > UNIX_TIMESTAMP(NOW()) - (15*60)"; $unique_posters_sql = "SELECT COUNT(DISTINCT(user_id_fk)) AS uniques FROM gforum_Post"; // ADBLOCK STATS SQL $date_limit = array("2", "30"); $date_append = "WHERE UNIX_TIMESTAMP(ai.timestamp) > UNIX_TIMESTAMP(NOW()) - (24*60*60)"; $adblock_users_sql = "SELECT DISTINCT(ai.user) AS uid, gu.user_username, gu.user_enabled FROM adblock_iplog AS ai RIGHT JOIN gforum_User AS gu ON gu.user_id = ai.user"; $adblock_email_all_sql = "SELECT DISTINCT(ai.user), gu.user_email FROM adblock_iplog AS ai RIGHT JOIN gforum_User AS gu ON gu.user_id = ai.user"; $adblock_email_enabled_sql = "SELECT DISTINCT(ai.user), gu.user_email FROM adblock_iplog AS ai RIGHT JOIN gforum_User AS gu ON gu.user_id = ai.user AND gu.user_enabled = 1"; $adblock_email_disabled_sql = "SELECT DISTINCT(ai.user), gu.user_email FROM adblock_iplog AS ai RIGHT JOIN gforum_User AS gu ON gu.user_id = ai.user AND gu.user_enabled = 0"; $adblock_ip_sql = "SELECT DISTINCT(ai.ipaddr) FROM adblock_iplog AS ai"; echo (""); ?> **Forum Stats**

"); ?> ONLINE NOW (Last 15 Minutes)
"); $sql = $online_now_sql; $results = mysql_query($sql); while ($row = mysql_fetch_array($results)) { echo ($row[online_now]); echo ("
\n\r"); } echo ("
"); // end online now ?> UNIQUE POSTERS
"); foreach ($user_date_limit AS $limit) { echo ("Last ".$limit." day(s): "); $sql = $unique_posters_sql." ".$user_date_append."*".$limit; $results = mysql_query($sql); while ($row = mysql_fetch_array($results)) { echo ($row[uniques]); } echo ("
"); } // end unique loop ?> ONE YEAR AGO
"); foreach ($user_date_limit AS $limit) { echo ("Last ".$limit." day(s): "); $user_year_append = "WHERE post_time > UNIX_TIMESTAMP(NOW()) - (24*60*60)*(365+".$limit.") AND post_time < UNIX_TIMESTAMP(NOW()) - (24*60*60)*(365)"; $sql = $unique_posters_sql." ".$user_year_append; $results = mysql_query($sql); while ($row = mysql_fetch_array($results)) { echo ($row[uniques]); } echo ("
"); } // end unique loop ?>
**AdBlock Stats**

"); ?> USERS
"); foreach ($date_limit AS $limit) { echo ("Last ".$limit." days
"); $sql = $adblock_users_sql." ".$date_append."*".$limit; $results = mysql_query($sql); while ($row = mysql_fetch_array($results)) { echo ("".$row[user_username].""); if ($row[user_enabled] == 1) { echo (" (enabled)"); } else { echo (" (disabled)"); } echo ("
\n\r"); } echo ("
"); } // end user loop ?> EMAIL
"); foreach ($date_limit AS $limit) { echo ("Last ".$limit." days
"); $sql = $adblock_email_all_sql." ".$date_append."*".$limit; $results = mysql_query($sql); echo ("ALL users: \n\r"); while ($row = mysql_fetch_array($results)) { echo ("".$row[user_email].", "); echo ("\n\r"); } echo ("

"); $sql = $adblock_email_enabled_sql." ".$date_append."*".$limit; $results = mysql_query($sql); echo ("ENABLED users: \n\r"); while ($row = mysql_fetch_array($results)) { echo ("".$row[user_email].", "); echo ("\n\r"); } echo ("

"); $sql = $adblock_email_disabled_sql." ".$date_append."*".$limit; $results = mysql_query($sql); echo ("DISABLED users: \n\r"); if (mysql_num_rows($results) == 0) { echo ("none"); } else { while ($row = mysql_fetch_array($results)) { echo ("".$row[user_email].", "); echo ("\n\r"); } } echo ("

"); } // end email loop ?> IPs
"); foreach ($date_limit AS $limit) { echo ("Last ".$limit." days
"); $sql = $adblock_ip_sql." ".$date_append."*".$limit; $results = mysql_query($sql); while ($row = mysql_fetch_array($results)) { echo ($row[ipaddr]); echo ("
\n\r"); } echo ("
"); } // end ip loop ?> "); ?>