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('{%pipe,generateExtensionInactiveNotInstalledMessage=top10%}');
55 $result = SQL_QUERY("SELECT
56 `userid`, `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 'last_online' => generateDateTime($content['last_online'], '3'),
76 $OUT .= loadTemplate('guest_top10_row_login', true, $content);
82 if ($count < getConfig('top10_max')) {
83 // Add more "blank" rows
84 for ($i = $count; $i <= getConfig('top10_max'); $i++) {
85 // Prepare data for template
91 $OUT .= loadTemplate('guest_top10_empty5', true, $content);
95 // Remember the rows in array
96 $rows['logins_out'] = $OUT;
99 SQL_FREERESULT($result);
102 $result = SQL_QUERY("SELECT
104 (SUM(p.points) - d.used_points) AS `points`,
107 `{?_MYSQL_PREFIX?}_user_data` AS d
109 {?_MYSQL_PREFIX?}_user_points AS p
114 d.`status`='CONFIRMED'
120 LIMIT {?top10_max?}", __FILE__, __LINE__);
122 $OUT = ''; $count = 1;
123 while ($content = SQL_FETCHARRAY($result)) {
124 // Prepare data for template
125 $content['cnt'] = $count;
126 $content['last_online'] = generateDateTime($content['last_online'], '3');
129 $OUT .= loadTemplate('guest_top10_row_earner', true, $content);
135 if ($count < getConfig('top10_max')) {
136 // Add more "blank" rows
137 for ($i = $count; $i <= getConfig('top10_max'); $i++) {
138 // Prepare data for template
144 $OUT .= loadTemplate('guest_top10_empty4', true, $content);
148 // Remember the rows in array
149 $rows['points_out'] = $OUT;
152 SQL_FREERESULT($result);
154 // TOP referal "hunter"
155 $result = SQL_QUERY("SELECT
157 SUM(r.counter) AS refs,
160 `{?_MYSQL_PREFIX?}_user_data` AS d
162 {?_MYSQL_PREFIX?}_refsystem AS r
167 d.`status`='CONFIRMED'
173 LIMIT {?top10_max?}", __FILE__, __LINE__);
175 $OUT = ''; $count = 1;
176 while ($content = SQL_FETCHARRAY($result)) {
177 // Prepare data for template
180 'userid' => $content['userid'],
181 'refs' => $content['refs'],
182 'last_online' => generateDateTime($content['last_online'], '3')
186 $OUT .= loadTemplate('guest_top10_row_refs', true, $content);
192 if ($count < getConfig('top10_max')) {
193 // Add more "blank" rows
194 for ($i = $count; $i <= getConfig('top10_max'); $i++) {
195 // Prepare data for template
201 $OUT .= loadTemplate('guest_top10_empty5', true, $content);
205 // Remember the rows in array
206 $rows['referals_out'] = $OUT;
209 SQL_FREERESULT($result);
211 // Load final template
212 loadTemplate('guest_top10', false, $rows);