2 /************************************************************************
\r
3 * MXChange v0.2.1 Start: 10/19/2003 *
\r
4 * =============== Last change: 11/19/2005 *
\r
6 * -------------------------------------------------------------------- *
\r
7 * File : what-bonus.php *
\r
8 * -------------------------------------------------------------------- *
\r
9 * Short description : Bonus pages for some extra points *
\r
10 * -------------------------------------------------------------------- *
\r
11 * Kurzbeschreibung : Bonusseiten f�r ein paar Extrapunkte *
\r
12 * -------------------------------------------------------------------- *
\r
14 * -------------------------------------------------------------------- *
\r
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
\r
16 * For more information visit: http://www.mxchange.org *
\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
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
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
34 // Some security stuff...
\r
35 if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
\r
37 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
\r
40 elseif (!IS_LOGGED_IN())
\r
42 LOAD_URL(URL."/modules.php[5~?module=index");
\r
44 elseif ((!EXT_IS_ACTIVE("bonus")) && (!IS_ADMIN()))
\r
46 ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE, "bonus");
\r
50 // Add description as navigation point
\r
51 ADD_DESCR("member", basename(__FILE__));
\r
52 OUTPUT_HTML ("</FONT><BR>");
\r
54 if (GET_EXT_VERSION("bonus") >= "0.6.9")
\r
56 // Add more bonus points here
\r
58 if ($CONFIG['bonus_click_yn'] == "Y") $USE .= " + turbo_bonus";
\r
59 if ($CONFIG['bonus_login_yn'] == "Y") $USE .= " + login_bonus";
\r
60 if ($CONFIG['bonus_order_yn'] == "Y") $USE .= " + bonus_order";
\r
61 if ($CONFIG['bonus_stats_yn'] == "Y") $USE .= " + bonus_stats";
\r
62 if ($CONFIG['bonus_ref_yn'] == "Y") $USE .= " + bonus_ref";
\r
68 $USE = "turbo_bonus";
\r
71 // Autopurge installed?
\r
72 $LAST = "%s"; $ONLINE = "";
\r
73 if (EXT_IS_ACTIVE("autopurge"))
\r
75 // Use last online timestamp to keep inactive members away from here
\r
76 $LAST = " AND last_online >= %s";
\r
77 $ONLINE = bigintval(time() - $CONFIG['ap_in_since']);
\r
80 // Let's check if there are some points left we can "pay"...
\r
81 $result = SQL_QUERY_ESC("SELECT userid, ".$USE." AS active_bonus, last_online FROM "._MYSQL_PREFIX."_user_data
\r
82 WHERE ".$USE." > 0 AND status='CONFIRMED'".$LAST."
\r
83 ORDER BY active_bonus DESC, last_online DESC, userid LIMIT %s",
\r
84 array($ONLINE, $CONFIG['bonus_ranks']), __FILE__, __LINE__);
\r
86 // Reset temporary variable and check for users
\r
88 if (SQL_NUMROWS($result) > 0)
\r
90 // Load our winners...
\r
92 while(list($uid, $turbo, $last) = SQL_FETCHROW($result))
\r
94 // Prepare data for the template
\r
98 'uid' => bigintval($uid),
\r
99 'points' => TRANSLATE_COMMA($turbo),
\r
100 'last' => MAKE_DATETIME($last, "2"),
\r
103 // Load row template
\r
104 $OUT .= LOAD_TEMPLATE("member_bonus_row", true, $content);
\r
106 // Count one up and switch colors
\r
107 $cnt++;$SW = 3 - $SW;
\r
112 // No one is interested in our "active rallye" ! :-(
\r
113 $OUT = LOAD_TEMPLATE("member_bonus_404", true);
\r
117 SQL_FREERESULT($result);
\r
119 // Remeber row(s) for the template
\r
120 define('__BONUS_ROWS', $OUT);
\r
122 // Load final template
\r
123 LOAD_TEMPLATE("member_bonus");
\r