174 lines
4.9 KiB
PHP
174 lines
4.9 KiB
PHP
<?PHP
|
|
|
|
require_once ("config.php");
|
|
|
|
// FORUM USERS SQL
|
|
/** Users online now?
|
|
Unique users posting over the last 1 day?
|
|
Unique users posting over the last 7 days?
|
|
Unique users posting over the last 30 days?
|
|
Versus same 30 days one year ago?
|
|
Unique users posting over the last 6 months? **/
|
|
|
|
$user_date_limit = array("1", "7", "30", "183");
|
|
$user_date_append = "WHERE post_time > 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 ("<font face=\"Tahoma,Arial,Helvetica\" size=\"2\">");
|
|
|
|
?>
|
|
|
|
<? echo ("<strong>**Forum Stats**</strong><br /><br />"); ?>
|
|
|
|
<? // Fetch the users online now
|
|
|
|
echo ("<strong>ONLINE NOW (Last 15 Minutes)</strong><br />");
|
|
$sql = $online_now_sql;
|
|
$results = mysql_query($sql);
|
|
while ($row = mysql_fetch_array($results)) {
|
|
echo ($row[online_now]);
|
|
echo ("<br />\n\r");
|
|
}
|
|
echo ("<br />");
|
|
|
|
// end online now
|
|
|
|
?>
|
|
|
|
<? // Fetch the unique posters
|
|
|
|
echo ("<strong>UNIQUE POSTERS</strong><br />");
|
|
foreach ($user_date_limit AS $limit) {
|
|
echo ("<strong>Last ".$limit." day(s)</strong>: ");
|
|
$sql = $unique_posters_sql." ".$user_date_append."*".$limit;
|
|
$results = mysql_query($sql);
|
|
while ($row = mysql_fetch_array($results)) {
|
|
echo ($row[uniques]);
|
|
}
|
|
echo ("<br />");
|
|
}
|
|
|
|
// end unique loop
|
|
|
|
?>
|
|
|
|
<? // Fetch the unique posters
|
|
|
|
echo ("<br /><strong>ONE YEAR AGO</strong><br />");
|
|
foreach ($user_date_limit AS $limit) {
|
|
echo ("<strong>Last ".$limit." day(s)</strong>: ");
|
|
$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 ("<br />");
|
|
}
|
|
|
|
// end unique loop
|
|
|
|
?>
|
|
|
|
|
|
<? echo ("<br /><br /><strong>**AdBlock Stats**</strong><br /><br />"); ?>
|
|
|
|
<? // Fetch the users
|
|
|
|
echo ("<strong>USERS</strong><br />");
|
|
foreach ($date_limit AS $limit) {
|
|
echo ("<strong>Last ".$limit." days</strong><br />");
|
|
$sql = $adblock_users_sql." ".$date_append."*".$limit;
|
|
$results = mysql_query($sql);
|
|
while ($row = mysql_fetch_array($results)) {
|
|
echo ("<a href='http://forum.slowtwitch.com/cgi-bin/admin/db.cgi?db=User;do=modify_search_results;user_id=".$row[uid].";user_id-opt=%3D'>".$row[user_username]."</a>");
|
|
if ($row[user_enabled] == 1) {
|
|
echo (" (enabled)");
|
|
} else {
|
|
echo (" (disabled)");
|
|
}
|
|
echo ("<br />\n\r");
|
|
}
|
|
echo ("<br />");
|
|
}
|
|
|
|
// end user loop
|
|
|
|
?>
|
|
|
|
<? // Fetch the email
|
|
|
|
echo ("<strong>EMAIL</strong><br />");
|
|
foreach ($date_limit AS $limit) {
|
|
echo ("<strong>Last ".$limit." days</strong><br />");
|
|
$sql = $adblock_email_all_sql." ".$date_append."*".$limit;
|
|
$results = mysql_query($sql);
|
|
echo ("ALL users: \n\r");
|
|
while ($row = mysql_fetch_array($results)) {
|
|
echo ("<a href='mailto:".$row[user_email]."'>".$row[user_email]."</a>, ");
|
|
echo ("\n\r");
|
|
}
|
|
echo ("<br /><br />");
|
|
|
|
$sql = $adblock_email_enabled_sql." ".$date_append."*".$limit;
|
|
$results = mysql_query($sql);
|
|
echo ("ENABLED users: \n\r");
|
|
while ($row = mysql_fetch_array($results)) {
|
|
echo ("<a href='mailto:".$row[user_email]."'>".$row[user_email]."</a>, ");
|
|
echo ("\n\r");
|
|
}
|
|
echo ("<br /><br />");
|
|
|
|
$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 ("<a href='mailto:".$row[user_email]."'>".$row[user_email]."</a>, ");
|
|
echo ("\n\r");
|
|
}
|
|
}
|
|
echo ("<br /><br />");
|
|
}
|
|
|
|
// end email loop
|
|
|
|
?>
|
|
|
|
<? // Fetch the ips
|
|
|
|
echo ("<strong>IPs</strong><br />");
|
|
foreach ($date_limit AS $limit) {
|
|
echo ("<strong>Last ".$limit." days</strong><br />");
|
|
$sql = $adblock_ip_sql." ".$date_append."*".$limit;
|
|
$results = mysql_query($sql);
|
|
while ($row = mysql_fetch_array($results)) {
|
|
echo ($row[ipaddr]);
|
|
echo ("<br />\n\r");
|
|
}
|
|
echo ("<br />");
|
|
}
|
|
|
|
// end ip loop
|
|
|
|
?>
|
|
|
|
<? echo ("</font>"); ?>
|