Add this into a custom page and set access to suit.
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright (C) 2002 - 2010 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: monthly_registrations.php
| Author: kneekoo
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
$locale['mrs_title'] = "Monthly Registrations";
$locale['mrs_timezone'] = "Europe/London";
$locale['mrs_back_to_main'] = "Go back to the main page";
$locale['mrs_back_to'] = "Go back to";
$locale['mrs_no_registrations'] = "There are no registrations for the current selection";
$locale['mrs_registered_on'] = "Members registered on";
$locale['mrs_none'] = "None";
$locale['mrs_days'] = array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
;
$locale['mrs_hour'] = "Hour";
$locale['mrs_unactivated'] = "Unactivated";
$locale['mrs_banned'] = "Banned";
$page_id = isset($_GET['page_id']) && isNum($_GET['page_id']) ? "page_id=".$_GET['page_id'] : "";
if ((substr(phpversion(), 0, 1) == '5' && substr(phpversion(), 2, 1) >= '1'
|| substr(phpversion(), 0, 1) > '5'
{
date_default_timezone_set($locale['mrs_timezone']);
}
$years_per_row = 3;
$sadmin = dbarray(dbquery("SELECT user_joined FROM ".DB_PREFIX."users WHERE user_id='1' LIMIT 1"
);
$sajoin = $sadmin['user_joined'];
$y_start = date("Y", $sajoin);
$m_start = date("n", $sajoin);
$y_end = date("Y", time());
$m_end = date("n", time());
$months = explode("|", $locale['months']);
$mode = "";
if (isset($_GET['mode']) && ($_GET['mode'] == 'm' || $_GET['mode'] == 'd'
) $mode = $_GET['mode'];
if ($mode == 'm'
{
if (!isset($_GET['year']) || !isNum($_GET['year']) || !isset($_GET['month']) || !isNum($_GET['month'])) {
$mode = "";
} else {
$get_year = $_GET['year'];
$get_month = $_GET['month'];
}
}
if ($mode == 'd'
{
if (!isset($_GET['year']) || !isNum($_GET['year']) || !isset($_GET['month']) || !isNum($_GET['month']) || !isset($_GET['day']) || !isNum($_GET['day'])) {
$mode = "";
} else {
$get_year = $_GET['year'];
$get_month = $_GET['month'];
$get_day = $_GET['day'];
}
}
switch ($mode) {
case 'm': {
add_to_title(" - ".$months[$get_month]." ".$get_year);
echo "<div align='center'><br />\n";
$m_stats = array();
$m_days = cal_days_in_month(CAL_GREGORIAN, $get_month, $get_year);
if ($get_year == date("Y", time()) && $get_month == date("m", time())) $m_days = date("d", time());
$m_min = mktime(0, 0, 0, $get_month, 1, $get_year) - 1;
$m_max = $m_min + ($m_days * 24 * 60 * 60);
$dates = dbquery("SELECT user_joined FROM ".$db_prefix."users WHERE user_joined > '".$m_min."' && user_joined < '".$m_max."' ORDER BY user_id ASC"
;
if (dbrows($dates)) {
while ($id = dbarray($dates)) {
$m_day = date("j", $id['user_joined']);
if (!isset($m_stats[$m_day])) {
$m_stats[$m_day] = 1;
} else {
$m_stats[$m_day]++;
}
}
echo "<p>[<a href='".BASEDIR.FUSION_SELF."?".$page_id."'>".$locale['mrs_back_to_main']."</a>]</p><br />";
echo "<table width='150' class='tbl-border' cellspacing='1' cellpadding='0'>\n";
echo " <tr>\n <td class='capmain' style='font-weight: bold'>$months[$get_month] $get_year</td><td class='capmain' align='center' style='font-weight: bold'>#</td>\n </tr>\n";
for ($i = 1; $i < $m_days + 1; $i++) {
echo " <tr>\n";
echo " <td align='left' class='tbl" . ($i % 2 ? "1" : "2"
. "'>" . $i . ", <a href='".BASEDIR.FUSION_SELF."?".$page_id."&mode=d&year=$get_year&month=$get_month&day=$i'>".$locale['mrs_days'][date("w", mktime(1, 1, 1, $get_month, $i, $get_year))]."</a></td>\n";
echo " <td align='center' class='tbl" . ($i % 2 ? "1" : "2"
. "'>". (isset($m_stats[$i]) ? $m_stats[$i] : "-"
. "</td>\n";
echo " </tr>\n";
}
echo "</table>\n</div>\n";
} else {
echo "<p>".$locale['mrs_no_registrations']."</p>\n";
}
unset($m_stats, $m_days, $m_min, $m_max, $dates, $id, $get_year, $get_month, $i);
break;
}
case 'd': {
add_to_title(" - ".$get_day." ".$months[$get_month]." ".$get_year);
echo "<div align='center'><br />\n";
echo "<p>[<a href='".BASEDIR.FUSION_SELF."?".$page_id."'>".$locale['mrs_back_to_main']."</a>] [<a href='".BASEDIR.FUSION_SELF."?".$page_id."&mode=m&year=$get_year&month=$get_month'>".$locale['mrs_back_to']." $months[$get_month] $get_year</a>]</p><br />";
$d_min = mktime(23, 59, 59, $get_month, $get_day-1, $get_year);
$d_max = $d_min + (24 * 60 * 60);
$members = dbquery("SELECT user_id, user_name, user_joined, user_status FROM ".$db_prefix."users WHERE user_joined > '".$d_min."' && user_joined < '".$d_max."' ORDER BY user_id ASC"
;
echo "<table width='350' class='tbl-border' cellspacing='1' cellpadding='0'>\n";
echo " <tr>\n <td class='capmain' style='font-weight: bold'>".$locale['mrs_registered_on']." ".date("d.m.Y", $d_min+1)."</td><td class='capmain' align='center' style='font-weight: bold'>".$locale['mrs_hour']."</td>\n </tr>\n";
if (dbrows($members) > 0) {
$cnt = 0;
while ($member = dbarray($members)) {
$cnt++;
echo " <tr>\n";
echo " <td align='left' class='tbl" . ($cnt % 2 ? "1" : "2"
. "'><a href='".BASEDIR."profile.php?lookup=".$member['user_id']."'>".$member['user_name']."</a>".($member['user_status'] > 0 ? ($member['user_status'] > 1 ? " <span class='small'>[".$locale['mrs_unactivated']."]</span>" : " <span class='small'>[".$locale['mrs_banned']."]</span>"
: ""
."</td>\n";
echo " <td align='center' class='tbl" . ($cnt % 2 ? "1" : "2"
. "'>". date("H:i:s", $member['user_joined']) . "</td>\n";
echo " </tr>\n";
}
} else {
echo " <tr>\n";
echo " <td colspan='2' class='tbl1 alt' align='center'>".$locale['mrs_none']."</td>\n";
echo " </tr>\n";
}
echo "</table>\n</div>\n";
break;
}
default: {
$stats = array();
$dates = dbquery("SELECT user_joined FROM ".$db_prefix."users ORDER BY user_id DESC"
;
while ($id = dbarray($dates)) {
$year = date("Y", $id['user_joined']);
$month = date("n", $id['user_joined']);
$date = $year."_".$month;
if (!isset($stats[$date])) {
$stats[$date] = 1;
} else {
$stats[$date]++;
}
}
$curr_year = 0;
$last_year = 0;
$cnt = 0;
$year_cnt = 0;
echo "<div align='center'>\n";
echo "<table cellspacing='10'>\n<tr><td style='vertical-align: top'>\n";
foreach ($stats as $key => $value) {
$curr_year_mon = explode("_", $key);
$last_year = $curr_year;
$curr_year = $curr_year_mon[0];
if ($curr_year != $last_year && $curr_year != 0) {
if ($last_year != 0) echo "</table></td>".($year_cnt % $years_per_row == 0 ? "</tr><tr>" : ""
."<td style='vertical-align: top'>\n";
echo "<table width='150' class='tbl-border' cellspacing='1' cellpadding='0'>\n <tr>\n <td class='capmain' align='left' style='font-weight: bold'>$curr_year</td><td class='capmain' align='center' style='font-weight: bold'>#</td>\n </tr>\n";
$cnt = 0;
$year_cnt++;
}
echo " <tr>\n <td class='tbl".($cnt % 2 == 0 ? "1" : "2"
."' align='left'><a href='".BASEDIR.FUSION_SELF."?".$page_id."&mode=m&year=".$curr_year."&month=".$curr_year_mon[1]."'>".$months[$curr_year_mon[1]]."</a></td><td align='center' class='tbl".($cnt % 2 == 0 ? "1" : "2"
."'>" . $value . "</td>\n </tr>\n";
$cnt++;
}
echo "</table>\n";
echo "</td>\n</tr>\n</table>\n";
echo "</div>";
unset($stats, $dates, $id, $year, $month, $date, $curr_year, $cnt, $key, $value);
}
}
unset($months, $mode);
?>[/syntaxhighlighter]