2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 11/24/2004 *
4 * =================== Last change: 11/26/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-top10.php *
8 * -------------------------------------------------------------------- *
9 * Short description : TOP logins / best earner etc. *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : TOP-Logins / Bestverdiener usw. *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2011 by Mailer Developer Team *
20 * For more information visit: http://www.mxchange.org *
22 * This program is free software; you can redistribute it and/or modify *
23 * it under the terms of the GNU General Public License as published by *
24 * the Free Software Foundation; either version 2 of the License, or *
25 * (at your option) any later version. *
27 * This program is distributed in the hope that it will be useful, *
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
30 * GNU General Public License for more details. *
32 * You should have received a copy of the GNU General Public License *
33 * along with this program; if not, write to the Free Software *
34 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
36 ************************************************************************/
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
43 // Add description as navigation point
44 addYouAreHereLink('guest', __FILE__);
46 if ((!isExtensionActive('top10')) && (!isAdmin())) {
47 displayMessage(generateExtensionInactiveNotInstalledMessage('top10'));
55 $result = SQL_QUERY("SELECT
56 `userid`, `total_logins`, `last_online`
58 `{?_MYSQL_PREFIX?}_user_data`
60 `total_logins` > 0 AND
64 LIMIT {?top10_max?}", __FILE__, __LINE__);
66 $OUT = ''; $count = 1;
67 while ($content = SQL_FETCHARRAY($result)) {
68 // Prepare data for template
71 'userid' => $content['userid'],
72 'nickname' => $content['nickname'],
73 'total_logins' => $content['total_logins'],
74 'points' => getTotalPoints($content['userid']),
75 'last_online' => generateDateTime($content['last_online'], 3),
79 $OUT .= loadTemplate('guest_top10_row_login', true, $content);
85 if ($count < getConfig('top10_max')) {
86 // Add more "blank" rows
87 for ($i = $count; $i <= getConfig('top10_max'); $i++) {
88 // Prepare data for template
94 $OUT .= loadTemplate('guest_top10_empty5', true, $content);
98 // Remember the rows in array
99 $rows['logins_out'] = $OUT;
102 SQL_FREERESULT($result);
105 $result = SQL_QUERY("SELECT
107 (SUM(p.points) - d.used_points) AS `points`,
110 `{?_MYSQL_PREFIX?}_user_data` AS d
112 {?_MYSQL_PREFIX?}_user_points AS p
117 d.`status`='CONFIRMED'
123 LIMIT {?top10_max?}", __FILE__, __LINE__);
125 $OUT = ''; $count = 1;
126 while ($content = SQL_FETCHARRAY($result)) {
127 // Prepare data for template
130 'userid' => $content['userid'],
131 'nickname' => $content['nickname'],
132 'points' => $content['points'],
133 'last_online' => generateDateTime($content['last_online'], 3)
137 $OUT .= loadTemplate('guest_top10_row_earner', true, $content);
143 if ($count < getConfig('top10_max')) {
144 // Add more "blank" rows
145 for ($i = $count; $i <= getConfig('top10_max'); $i++) {
146 // Prepare data for template
152 $OUT .= loadTemplate('guest_top10_empty4', true, $content);
156 // Remember the rows in array
157 $rows['points_out'] = $OUT;
160 SQL_FREERESULT($result);
162 // TOP referal "hunter"
163 $result = SQL_QUERY("SELECT
165 SUM(r.counter) AS refs,
168 `{?_MYSQL_PREFIX?}_user_data` AS d
170 {?_MYSQL_PREFIX?}_refsystem AS r
175 d.`status`='CONFIRMED'
181 LIMIT {?top10_max?}", __FILE__, __LINE__);
183 $OUT = ''; $count = 1;
184 while ($content = SQL_FETCHARRAY($result)) {
185 // Prepare data for template
188 'userid' => $content['userid'],
189 'refs' => $content['refs'],
190 'nickname' => $content['nickname'],
191 'last_online' => generateDateTime($content['last_online'], 3)
195 $OUT .= loadTemplate('guest_top10_row_refs', true, $content);
201 if ($count < getConfig('top10_max')) {
202 // Add more "blank" rows
203 for ($i = $count; $i <= getConfig('top10_max'); $i++) {
204 // Prepare data for template
210 $OUT .= loadTemplate('guest_top10_empty5', true, $content);
214 // Remember the rows in array
215 $rows['referals_out'] = $OUT;
218 SQL_FREERESULT($result);
220 // Load final template
221 loadTemplate('guest_top10', false, $rows);