************************************************************************/
// Some security stuff...
-if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
-{
+if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) {
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
require($INC);
}
+
// Add description as navigation point
ADD_DESCR("guest", basename(__FILE__));
// Derterminate which stats we want and set mode and title for the link below stats block
-if (!isset($_GET['mode'])) $_GET['mode'] = strtolower($CONFIG['guest_stats']);
+if (!isset($_GET['mode'])) $_GET['mode'] = strtolower($_CONFIG['guest_stats']);
switch ($_GET['mode'])
{
- case "members": $CONFIG['guest_stats'] = "MEMBERS"; $lmode = "modules"; $ltitle = GUEST_STATS_MODULES; break;
- case "modules": $CONFIG['guest_stats'] = "MODULES"; $lmode = "members"; $ltitle = GUEST_STATS_MEMBERS; break;
+ case "members": $_CONFIG['guest_stats'] = "MEMBERS"; $lmode = "modules"; $ltitle = GUEST_STATS_MODULES; break;
+ case "modules": $_CONFIG['guest_stats'] = "MODULES"; $lmode = "members"; $ltitle = GUEST_STATS_MEMBERS; break;
}
-OPEN_TABLE("100%", "guest_content", "center", "top");
-switch ($CONFIG['guest_stats'])
+switch ($_CONFIG['guest_stats'])
{
case "MEMBERS": // Statistics about your members
// Members yesterday / today online
for ($idx = 1; $idx < 13; $idx++)
{
$month = $idx; if ($idx < 10) $month = "0".$idx;
- $months[$month] = SQL_NUMROWS(SQL_QUERY_ESC("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE birth_month=%d AND status='CONFIRMED'",
+ $months[$month] = SQL_NUMROWS(SQL_QUERY_ESC("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE birth_month=%s AND status='CONFIRMED'",
array(bigintval($month)), __FILE__, __LINE__));
}
}
// Now we have all categories loaded, count members
- foreach ($cats as $id=>$dummy)
+ foreach ($cats as $id => $dummy)
{
// We only need id and nothing more to count...
- $cat_cnt[$id] = SQL_NUMROWS(SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_user_cats WHERE cat_id=%d",
+ $cat_cnt[$id] = SQL_NUMROWS(SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_user_cats WHERE cat_id=%s",
array(bigintval($id)), __FILE__, __LINE__));
}
// Generate monthly stats
$SW = 2; $r2 = " right2"; $l = "ll"; $r = "lr"; $OUT = "";
- foreach ($months as $month=>$cnt)
+ foreach ($months as $month => $cnt)
{
if ($SW == 2) $OUT .= "<TR>\n";
// Generate category stats
$SW = 2; $OUT = "";
- foreach ($cat_cnt as $id=>$cnt)
+ foreach ($cat_cnt as $id => $cnt)
{
// Prepare data for the template
$content = array(
if ((SQL_NUMROWS($guest_t10) > 0) || (SQL_NUMROWS($mem_t10) > 0))
{
// Output header
- OUTPUT_HTML ("<TABLE border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"guest_table dashed\" width=\"310\">
+ OUTPUT_HTML("<TABLE border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"guest_table dashed\" width=\"310\">
<TR>
<TD align=\"center\" class=\"guest_stats_title bottom2\" colspan=\"2\"><STRONG>".GUEST_TOPTEN_STATS."</STRONG></TD>
</TR>");
if (SQL_NUMROWS($guest_t10) > 0)
{
// Guest clicks
- OUTPUT_HTML ("<TR>
+ OUTPUT_HTML("<TR>
<TD align=\"center\" class=\"guest_title2 bottom2\" colspan=\"2\">".GUEST_TOP_GUEST_STATS."</TD>
</TR>");
$SW = 2;
while (list($clicks, $title) = SQL_FETCHROW($guest_t10))
{
- OUTPUT_HTML ("<TR>
+ OUTPUT_HTML("<TR>
<TD class=\"switch_sw".$SW." bottom2 right2\" align=\"right\" width=\"250\">".$title." </TD>
<TD class=\"switch_sw".$SW." bottom2\" width=\"50\"> ".$clicks."</TD>
</TR>");
if (SQL_NUMROWS($guest_t10) > 0)
{
// Guest clicks
- OUTPUT_HTML ("<TR>
+ OUTPUT_HTML("<TR>
<TD align=\"center\" class=\"guest_title2 bottom2\" colspan=\"2\">".GUEST_TOP_MEMBER_STATS."</TD>
</TR>");
$SW = 2;
while (list($clicks, $title) = SQL_FETCHROW($mem_t10))
{
- OUTPUT_HTML ("<TR>
+ OUTPUT_HTML("<TR>
<TD class=\"switch_sw".$SW." bottom2 right2\" align=\"right\" width=\"250\">".$title." </TD>
<TD class=\"switch_sw".$SW." bottom2\" width=\"50\"> ".$clicks."</TD>
</TR>");
if ((SQL_NUMROWS($guest_t10) > 0) || (SQL_NUMROWS($mem_t10) > 0))
{
// Output footer
- OUTPUT_HTML ("<TR>
+ OUTPUT_HTML("<TR>
<TD align=\"center\" class=\"guest_stats_footer\" colspan=\"2\"><A href=\"".URL."/modules.php?module=index&what=stats&mode=".$lmode."\">".$ltitle."</A></TD>
</TR>
</TABLE>");
LOAD_TEMPLATE("admin_settings_saved", false, "<STRONG>".GUEST_STATS_DEACTIVATED."</STRONG>");
break;
}
-CLOSE_TABLE();
+
//
?>