2 /************************************************************************
3 * MXChange v0.2.1 Start: 11/13/2004 *
4 * =============== Last change: 11/14/2004 *
6 * -------------------------------------------------------------------- *
7 * File : show_bonus.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Show ranking list for turbo-bonus *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Rankliste fuer Turbo-Bonus anzeigen *
12 * -------------------------------------------------------------------- *
14 * -------------------------------------------------------------------- *
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
16 * For more information visit: http://www.mxchange.org *
18 * This program is free software; you can redistribute it and/or modify *
19 * it under the terms of the GNU General Public License as published by *
20 * the Free Software Foundation; either version 2 of the License, or *
21 * (at your option) any later version. *
23 * This program is distributed in the hope that it will be useful, *
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
26 * GNU General Public License for more details. *
28 * You should have received a copy of the GNU General Public License *
29 * along with this program; if not, write to the Free Software *
30 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
32 ************************************************************************/
34 // Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) )
35 require_once("inc/libs/security_functions.php");
37 // Init "action" and "what"
38 global $what, $action, $startTime;
39 $GLOBALS['startTime'] = microtime(true);
40 $GLOBALS['what'] = "";
41 $GLOBALS['action'] = "";
43 // Set this because we have no module in URI
44 $GLOBALS['module'] = "show_bonus"; $CSS = 0;
46 // Load the required file(s)
47 require("inc/config.php");
49 // Is the "bonus" extension active?
50 if (!EXT_IS_ACTIVE("bonus")) {
52 LOAD_URL("modules.php?module=index&msg=".CODE_EXTENSION_PROBLEM."&ext=bonus");
55 // List only rankings when script is installed
56 if (isBooleanConstantAndTrue('mxchange_installed')) {
58 include(PATH."inc/header.php");
60 if (($_GET['uid'] > 0) && ($_GET['d'] > 0) && (!empty($_GET['t']))) {
64 case "bonusid": // Bonus mail
68 case "mailid": // Regular member mail
72 default: // Invalid type
73 DEBUG_LOG(__FILE__, __LINE__, sprintf("Invalid type %s detected.", $_GET['t']));
80 $result = SQL_QUERY_ESC("SELECT DISTINCT d.gender, d.surname, d.family, b.level, b.points
81 FROM `"._MYSQL_PREFIX."_user_data` AS d
82 RIGHT JOIN "._MYSQL_PREFIX."_bonus_turbo AS b
84 WHERE d.status='CONFIRMED' AND d.userid=%s AND b.%s=%s
86 array(bigintval($_GET['uid']), $t, bigintval($_GET['d'])), __FILE__, __LINE__);
89 if (SQL_NUMROWS($result) == 1) {
91 $content = SQL_FETCHARRAY($result);
93 // Prepare constants for the pre-template
94 define('__GENDER' , TRANSLATE_GENDER($content['gender']));
95 define('__SNAME' , $content['surname']);
96 define('__FNAME' , $content['family']);
97 define('__RANK' , BIGINTVAL($content['level']));
98 define('__POINTS' , TRANSLATE_COMMA($content['points']));
99 define('__MAILID' , bigintval($_GET['d']));
100 define('__RANK_ROWS', BONUS_MAKE_RANK_ROWS(bigintval($_GET['d']), $t, bigintval($_GET['uid'])));
102 // Constant created within previous function which contains informations for current user's ranking position:
103 // __YOUR_RANKING_LINE
106 define('__BONUS_MSG', LOAD_TEMPLATE("show_bonus_msg", true));
109 define('__BONUS_MSG', "<span class=\"guest_failed\">".BONUS_SHOW_NO_DATA."</span>");
113 SQL_FREERESULT($result);
115 // Wrong type entered
116 define('__BONUS_MSG', "<span class=\"guest_failed\">".BONUS_SHOW_WRONG_TYPE."</span>");
120 define('__BONUS_MSG', "<span class=\"guest_failed\">".BONUS_SHOW_WRONG_CALL."</span>");
123 // Load send_bonus header template (for your banners, e.g.?)
124 define('__BONUS_HEADER', LOAD_TEMPLATE("show_bonus_header", true));
126 // Load show_bonus footer template (for your banners, e.g.?)
127 define('__BONUS_FOOTER', LOAD_TEMPLATE("show_bonus_footer", true));
129 // Total ranks who can win
130 define('__BONUS_TOTAL_RANKS', getConfig('bonus_ranks'));
132 // Load final template
133 LOAD_TEMPLATE("show_bonus");
136 include(PATH."inc/footer.php");
138 // You have to configure first!
139 LOAD_URL("install.php");
142 // Really all done here... ;-)