************************************************************************/
// Some security stuff...
-if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) {
+if (!defined('__SECURITY')) {
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
require($INC);
}
// Add description as navigation point
-ADD_DESCR("guest", basename(__FILE__));
+ADD_DESCR("guest", __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']);
-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;
+if (!isset($_GET['mode'])) $_GET['mode'] = strtolower(getConfig('guest_stats'));
+switch ($_GET['mode']) {
+ case "members" :
+ setConfigEntry('guest_stats', "MEMBERS");
+ $lmode = "modules";
+ $ltitle = getMessage('GUEST_STATS_MODULES');
+ break;
+
+ case "modules" :
+ setConfigEntry('guest_stats', "MODULES");
+ $lmode = "members";
+ $ltitle = getMessage('GUEST_STATS_MEMBERS');
+ break;
+
+ case "inactive":
+ setConfigEntry('guest_stats', "INACTIVE");
+ $lmode = "inactive";
+ $ltitle = getMessage('GUEST_STATS_INACTIVE');
+ break;
}
-switch ($_CONFIG['guest_stats'])
+switch (getConfig('guest_stats'))
{
case "MEMBERS": // Statistics about your members
// Members yesterday / today online
- $ymem = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE last_online >= ".START_YDAY." AND last_online < ".START_TDAY." AND status='CONFIRMED'", __FILE__, __LINE__));
- $tmem = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE last_online >= ".START_TDAY." AND status='CONFIRMED'", __FILE__, __LINE__));
+ $ymem = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE last_online >= ".START_YDAY." AND last_online < ".START_TDAY." AND `status`='CONFIRMED'", __FILE__, __LINE__));
+ $tmem = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE last_online >= ".START_TDAY." AND `status`='CONFIRMED'", __FILE__, __LINE__));
// Yesterday / today registered
- $yreg = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE joined >= ".START_YDAY." AND joined < ".START_TDAY, __FILE__, __LINE__));
- $treg = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE joined >= ".START_TDAY, __FILE__, __LINE__));
+ $yreg = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE joined >= ".START_YDAY." AND joined < ".START_TDAY, __FILE__, __LINE__));
+ $treg = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE joined >= ".START_TDAY, __FILE__, __LINE__));
// Only males / females
- $male = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE sex='M' AND status='CONFIRMED'", __FILE__, __LINE__));
- $female = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE sex='F' AND status='CONFIRMED'", __FILE__, __LINE__));
+ $male = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE gender='M' AND `status`='CONFIRMED'", __FILE__, __LINE__));
+ $female = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE gender='F' AND `status`='CONFIRMED'", __FILE__, __LINE__));
// Unconfirmed accounts
- $unconfirmed = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE status != 'CONFIRMED'", __FILE__, __LINE__));
+ $unconfirmed = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE status != 'CONFIRMED'", __FILE__, __LINE__));
// Total members
$total = $male + $female;
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=%s 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__));
}
// Members in categories
- $result = SQL_QUERY("SELECT id, cat FROM "._MYSQL_PREFIX."_cats WHERE visible='Y' ORDER BY id", __FILE__, __LINE__);
+ $result = SQL_QUERY("SELECT id, cat FROM `{!_MYSQL_PREFIX!}_cats` WHERE `visible`='Y' ORDER BY `id`", __FILE__, __LINE__);
// Load categories first
$cats = array(); $cat_cnt = array();
- while (list($id, $cat) = SQL_FETCHROW($result))
- {
+ while (list($id, $cat) = SQL_FETCHROW($result)) {
// Simple...
$cats[$id] = $cat;
}
// 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=%s",
- array(bigintval($id)), __FILE__, __LINE__));
+ $cat_cnt[$id] = SQL_NUMROWS(SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_cats` WHERE cat_id=%s",
+ array(bigintval($id)), __FILE__, __LINE__));
}
// Prepare data for the template
$SW = 2; $r2 = " right2"; $l = "ll"; $r = "lr"; $OUT = "";
foreach ($months as $month => $cnt)
{
- if ($SW == 2) $OUT .= "<TR>\n";
+ if ($SW == 2) $OUT .= "<tr>\n";
// Prepare data for template
$content = array(
}
else
{
- $OUT .= "</TR>\n";
+ $OUT .= "</tr>\n";
$r2 = " right2";
$l = "ll"; $r = "lr";
}
case "MODULES": // TOP10 module clicks
$AND = "";
- if (!IS_ADMIN()) $AND = " AND locked='N' AND visible='Y'";
- $guest_t10 = SQL_QUERY("SELECT counter, title FROM "._MYSQL_PREFIX."_guest_menu WHERE counter > 0".$AND." ORDER BY counter DESC LIMIT 0,10", __FILE__, __LINE__);
- $mem_t10 = SQL_QUERY("SELECT counter, title FROM "._MYSQL_PREFIX."_member_menu WHERE counter > 0".$AND." ORDER BY counter DESC LIMIT 0,10", __FILE__, __LINE__);
- if ((SQL_NUMROWS($guest_t10) > 0) || (SQL_NUMROWS($mem_t10) > 0))
- {
+ if (!IS_ADMIN()) $AND = " AND `locked`='N' AND `visible`='Y'";
+ $guest_t10 = SQL_QUERY("SELECT counter, title FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE counter > 0".$AND." ORDER BY counter DESC LIMIT 0,10", __FILE__, __LINE__);
+ $mem_t10 = SQL_QUERY("SELECT counter, title FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE counter > 0".$AND." ORDER BY counter DESC LIMIT 0,10", __FILE__, __LINE__);
+ 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\">
-<TR>
- <TD align=\"center\" class=\"guest_stats_title bottom2\" colspan=\"2\"><STRONG>".GUEST_TOPTEN_STATS."</STRONG></TD>
-</TR>");
+ 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)
- {
+ if (SQL_NUMROWS($guest_t10) > 0) {
// Guest clicks
- OUTPUT_HTML("<TR>
- <TD align=\"center\" class=\"guest_title2 bottom2\" colspan=\"2\">".GUEST_TOP_GUEST_STATS."</TD>
-</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>
- <TD class=\"switch_sw".$SW." bottom2 right2\" align=\"right\" width=\"250\">".$title." </TD>
- <TD class=\"switch_sw".$SW." bottom2\" width=\"50\"> ".$clicks."</TD>
-</TR>");
+ while (list($clicks, $title) = SQL_FETCHROW($guest_t10)) {
+ 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>");
$SW = 3 - $SW;
}
}
- if (SQL_NUMROWS($guest_t10) > 0)
- {
+
+ if (SQL_NUMROWS($guest_t10) > 0) {
// Guest clicks
- OUTPUT_HTML("<TR>
- <TD align=\"center\" class=\"guest_title2 bottom2\" colspan=\"2\">".GUEST_TOP_MEMBER_STATS."</TD>
-</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>
- <TD class=\"switch_sw".$SW." bottom2 right2\" align=\"right\" width=\"250\">".$title." </TD>
- <TD class=\"switch_sw".$SW." bottom2\" width=\"50\"> ".$clicks."</TD>
-</TR>");
+ while (list($clicks, $title) = SQL_FETCHROW($mem_t10)) {
+ 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>");
$SW = 3 - $SW;
}
}
- if ((SQL_NUMROWS($guest_t10) > 0) || (SQL_NUMROWS($mem_t10) > 0))
- {
+
+ if ((SQL_NUMROWS($guest_t10) > 0) || (SQL_NUMROWS($mem_t10) > 0)) {
// Output footer
- 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>");
+ 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>");
}
break;
case "INACTIVE": // Deactivated stats
- LOAD_TEMPLATE("admin_settings_saved", false, "<STRONG>".GUEST_STATS_DEACTIVATED."</STRONG>");
+ LOAD_TEMPLATE("admin_settings_saved", false, "<strong>{--GUEST_STATS_DEACTIVATED--}</strong>");
break;
}