(no commit message)
[mailer.git] / 0.2.1 / inc / modules / admin / what-user_online.php
1 <?php\r
2 /************************************************************************\r
3  * MXChange v0.2.1                                    Start: 02/02/2004 *\r
4  * ================                             Last change: 07/13/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 \r
41 // Add description as navigation point\r
42 ADD_DESCR("admin", basename(__FILE__));\r
43 OUTPUT_HTML ("</FONT><BR><BR>");\r
44 \r
45 // Count guests, members and admins\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 OUTPUT_HTML("<TABLE border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\" width=\"170\" class=\"admin_table dashed\">\r
51 <TR><TD colspan=\"5\" height=\"7\" class=\"seperator admin_title\">&nbsp;</TD></TR>\r
52 <TR>\r
53   <TD colspan=\"3\" class=\"admin_title\" align=\"center\">\r
54     <STRONG>".USER_NOW_ONLINE."</STRONG>\r
55   </TD>\r
56 </TR>\r
57 <TR><TD colspan=\"5\" height=\"7\" class=\"seperator admin_title\">&nbsp;</TD></TR>\r
58 <TR>\r
59   <TD width=\"85%\" class=\"top2 bottom2\" align=\"right\"><FONT class=\"medium\">".GUESTS_ONLINE.":</FONT></TD>\r
60   <TD width=\"5%\" class=\"top2 bottom2\">&nbsp;</TD>\r
61   <TD width=\"10%\" class=\"top2 bottom2\"><B>".SQL_NUMROWS($result_guests)."</B></TD>\r
62 </TR>\r
63 <TR>\r
64   <TD width=\"85%\" class=\"bottom2\" align=\"right\"><FONT class=\"medium\">".MEMBERS_ONLINE.":</FONT></TD>\r
65   <TD width=\"5%\" class=\"bottom2\">&nbsp;</TD>\r
66   <TD width=\"10%\" class=\"bottom2\"><B>".SQL_NUMROWS($result_members)."</B></TD>\r
67 </TR>\r
68 <TR>\r
69   <TD width=\"85%\" align=\"right\"><FONT class=\"medium\">".ADMINS_ONLINE.":</FONT></TD>\r
70   <TD width=\"5%\">&nbsp;</TD>\r
71   <TD width=\"10%\"><B>".SQL_NUMROWS($result_admins)."</B></TD>\r
72 </TR>\r
73 </TABLE><BR>");\r
74 \r
75 $result = SQL_QUERY("SELECT id, ip, userid, refid, module, action, what, is_member, is_admin, timestamp FROM "._MYSQL_PREFIX."_online ORDER by timestamp DESC", __FILE__, __LINE__);\r
76 if (SQL_NUMROWS($result) > 0)\r
77 {\r
78         // Load header template\r
79         LOAD_TEMPLATE("admin_online_header");\r
80 \r
81         // List all online users\r
82         $SW = 2;\r
83         while (list($id, $ip, $userid, $refid, $module, $action, $what, $mem, $admin, $time) = SQL_FETCHROW($result))\r
84         {\r
85                 if ($action == "") $action = "---";\r
86                 if ($what   == "")   $what = "---";\r
87 \r
88                 if ($admin == "Y")\r
89                 {\r
90                         // Is an administrator\r
91                         $userid = _IS_ADMIN;\r
92                 }\r
93                  elseif (($mem == "N") && ($admin == "N"))\r
94                 {\r
95                         // Is a guest\r
96                         $userid = _IS_GUEST;\r
97                 }\r
98                 OUTPUT_HTML("<TR>\r
99   <TD align=\"center\" width=\"5%\" class=\"switch_sw".$SW." bottom right\">".$id."</TD>\r
100   <TD align=\"center\" width=\"15%\" class=\"switch_sw".$SW." bottom right\">");\r
101                 if ($userid > 0)\r
102                 {\r
103                         OUTPUT_HTML("<A href=\"".URL."/modules.php?module=admin&amp;what=list_user&amp;u_id=".$userid."\">".$userid."</A>");\r
104                 }\r
105                  else\r
106                 {\r
107                         OUTPUT_HTML($userid);\r
108                 }\r
109                 if ($refid > 0)\r
110                 {\r
111                         $refid = "<A href=\"".URL."/modules.php?module=admin&amp;what=list_user&amp;u_id=".$refid."\">".$refid."</A>";\r
112                 }\r
113                 OUTPUT_HTML("</TD>\r
114   <TD align=\"center\" width=\"10%\" class=\"switch_sw".$SW." bottom right\">".$ip."</TD>\r
115   <TD align=\"center\" width=\"5%\" class=\"switch_sw".$SW." bottom right\">".$refid."</TD>\r
116   <TD align=\"center\" width=\"10%\" class=\"switch_sw".$SW." bottom right\">".$module."</TD>\r
117   <TD align=\"center\" width=\"10%\" class=\"switch_sw".$SW." bottom right\">".$action."</TD>\r
118   <TD align=\"center\" width=\"5%\" class=\"switch_sw".$SW." bottom right\">".$what."</TD>\r
119   <TD align=\"center\" width=\"10%\" class=\"switch_sw".$SW." bottom\">".MAKE_DATETIME($time, "2")."</TD>\r
120 </TR>");\r
121                 $SW = 3 - $SW;\r
122         }\r
123         OUTPUT_HTML("<TR>\r
124   <TD colspan=\"8\" align=\"center\" class=\"admin_footer\">\r
125     ".ONLINE_TIMEOUT_IS_1.CREATE_FANCY_TIME($CONFIG['online_timeout']).ONLINE_TIMEOUT_IS_2."\r
126   </TD>\r
127 </TR>\r
128 </TABLE>");\r
129 }\r
130 //\r
131 ?>\r