(no commit message)
[mailer.git] / 0.2.1 / inc / modules / guest / action-online.php
1 <?php\r
2 /************************************************************************\r
3  * MXChange v0.2.1                                    Start: 02/02/2004 *\r
4  * ================                             Last change: 11/26/2004 *\r
5  *                                                                      *\r
6  * -------------------------------------------------------------------- *\r
7  * File              : action-online.php                                *\r
8  * -------------------------------------------------------------------- *\r
9  * Short description : Who is where? (DO NOT add sub menus!)            *\r
10  * -------------------------------------------------------------------- *\r
11  * Kurzbeschreibung  : Wer ist wo? (KEINE Untermenues anhaengen!)       *\r
12  * -------------------------------------------------------------------- *\r
13  *                                                                      *\r
14  * -------------------------------------------------------------------- *\r
15  * Copyright (c) 2003 - 2007 by Roland Haeder                           *\r
16  * For more information visit: http://www.mxchange.org                  *\r
17  *                                                                      *\r
18  * This program is free software; you can redistribute it and/or modify *\r
19  * it under the terms of the GNU General Public License as published by *\r
20  * the Free Software Foundation; either version 2 of the License, or    *\r
21  * (at your option) any later version.                                  *\r
22  *                                                                      *\r
23  * This program is distributed in the hope that it will be useful,      *\r
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *\r
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *\r
26  * GNU General Public License for more details.                         *\r
27  *                                                                      *\r
28  * You should have received a copy of the GNU General Public License    *\r
29  * along with this program; if not, write to the Free Software          *\r
30  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *\r
31  * MA  02110-1301  USA                                                  *\r
32  ************************************************************************/\r
33 \r
34 // Some security stuff...\r
35 if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))\r
36 {\r
37         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php";\r
38         require($INC);\r
39 }\r
40  elseif (!EXT_IS_ACTIVE("online"))\r
41 {\r
42         // Just skip this extension\r
43         return;\r
44 }\r
45 \r
46 $result_guests  = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_online WHERE is_admin='N' AND is_member='N'", __FILE__, __LINE__);\r
47 $result_members = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_online WHERE is_admin='N' AND is_member='Y'", __FILE__, __LINE__);\r
48 $result_admins  = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_online WHERE is_admin='Y'", __FILE__, __LINE__);\r
49 \r
50 // Total visitors online\r
51 $total      = SQL_NUMROWS($result_guests) + SQL_NUMROWS($result_members) + SQL_NUMROWS($result_admins);\r
52 if ($CONFIG['mad_counter'] < $total)\r
53 {\r
54         // Update counter\r
55         $CONFIG['mad_counter'] = $total;\r
56         $CONFIG['last_mad']    = time();\r
57         $result_mad = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET mad_timestamp=%d, mad_count='%s' WHERE config='0' LIMIT 1",\r
58          array($CONFIG['last_mad'], $CONFIG['mad_counter']), __FILE__, __LINE__);\r
59 \r
60         // Destroy cache\r
61 }\r
62 \r
63 // Put all values in constants for the template\r
64 define('GUESTS_ONLINE_CNT' , SQL_NUMROWS($result_guests));\r
65 define('MEMBERS_ONLINE_CNT', SQL_NUMROWS($result_members));\r
66 define('ADMINS_ONLINE_CNT' , SQL_NUMROWS($result_admins));\r
67 \r
68 // Output table\r
69 LOAD_TEMPLATE("online_now");\r
70 \r
71 if (EXT_IS_ACTIVE("active"))\r
72 {\r
73         // Add link to "we were active today" page\r
74         LOAD_TEMPLATE("guest_menu_bottom", false, "<A class=\"menu_blur\" href=\"".URL."/modules.php?module=index&amp;what=active\">".$CONFIG['middot'].GUEST_ACTIVE_LINK."</A>");\r
75 }\r
76 \r
77 //\r
78 ?>\r