List active/inactive extensions
[mailer.git] / 0.2.1 / show_bonus.php
1 <?php\r
2 /************************************************************************\r
3  * MXChange v0.2.1                                    Start: 11/13/2004 *\r
4  * ===============                              Last change: 11/14/2004 *\r
5  *                                                                      *\r
6  * -------------------------------------------------------------------- *\r
7  * File              : show_bonus.php                                   *\r
8  * -------------------------------------------------------------------- *\r
9  * Short description : Show ranking list for turbo-bonus                *\r
10  * -------------------------------------------------------------------- *\r
11  * Kurzbeschreibung  : Rankliste fuer Turbo-Bonus anzeigen              *\r
12  * -------------------------------------------------------------------- *\r
13  *                                                                      *\r
14  * -------------------------------------------------------------------- *\r
15  * Copyright (c) 2003 - 2008 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 // Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) )\r
35 require_once("inc/libs/security_functions.php");\r
36 \r
37 // Init "action" and "what"\r
38 global $what, $action;\r
39 $GLOBALS['what'] = ""; $GLOBALS['action'] = "";\r
40 if (!empty($_GET['action'])) $GLOBALS['action'] = trim(strip_tags($_GET['action']));\r
41 if (!empty($_GET['what'])) $GLOBALS['what'] = trim(strip_tags($_GET['what']));\r
42 \r
43 // Set this because we have no module in URI\r
44 $GLOBALS['module'] = "show_bonus"; $CSS = 0;\r
45 \r
46 // Load the required file(s)\r
47 require ("inc/config.php");\r
48 \r
49 // List only rankings when script is installed\r
50 if (defined('mxchange_installed') && (mxchange_installed))\r
51 {\r
52         // Include header\r
53         include(PATH."inc/header.php");\r
54 \r
55         if (($_GET['uid'] > 0) && ($_GET['d'] > 0) && (!empty($_GET['t'])))\r
56         {\r
57                 // Set row name\r
58                 $t = "";\r
59                 switch ($_GET['t'])\r
60                 {\r
61                 case "bonusid":\r
62                         $t = "bonus_id";\r
63                         break;\r
64 \r
65                 case "mailid":\r
66                         $t = "mail_id";\r
67                         break;\r
68                 }\r
69                 if (!empty($t))\r
70                 {\r
71                         // Check for data\r
72                         $result = SQL_QUERY_ESC("SELECT DISTINCT d.sex, d.surname, d.family, b.level, b.points\r
73 FROM "._MYSQL_PREFIX."_user_data AS d\r
74 RIGHT JOIN "._MYSQL_PREFIX."_bonus_turbo AS b\r
75 ON d.userid=b.userid\r
76 WHERE d.status='CONFIRMED' AND d.userid=%d AND b.".$t."='%s' LIMIT 1",\r
77  array(bigintval($_GET['uid']), bigintval($_GET['d'])), __FILE__, __LINE__);\r
78                         if (SQL_NUMROWS($result) == 1)\r
79                         {\r
80                                 // Load data\r
81                                 list($sex, $sname, $fname, $level, $points) = SQL_FETCHROW($result);\r
82 \r
83                                 // Prepare constants for the pre-template\r
84                                 define('__SALUT'    , TRANSLATE_SEX($sex));\r
85                                 define('__SNAME'    , $sname);\r
86                                 define('__FNAME'    , $fname);\r
87                                 define('__RANK'     , $level);\r
88                                 define('__POINTS'   , $points);\r
89                                 define('__MAILID'   , $_GET['d']);\r
90                                 define('__RANK_ROWS', BONUS_MAKE_RANK_ROWS(bigintval($_GET['d']), $t, bigintval($_GET['uid'])));\r
91 \r
92                                 // Constant created within previous function which contains informations for current user's ranking position:\r
93                                 //   __YOUR_RANKING_LINE\r
94 \r
95                                 // Load pre-template\r
96                                 define('__BONUS_MSG', LOAD_TEMPLATE("show_bonus_msg", true));\r
97                         }\r
98                          else\r
99                         {\r
100                                 // No data found\r
101                                 define('__BONUS_MSG', "<FONT class=\"guest_failed\">".BONUS_SHOW_NO_DATA."</FONT>");\r
102                         }\r
103 \r
104                         // Free memory\r
105                         SQL_FREERESULT($result);\r
106                 }\r
107                  else\r
108                 {\r
109                         // Wrong type entered\r
110                         define('__BONUS_MSG', "<FONT class=\"guest_failed\">".BONUS_SHOW_WRONG_TYPE."</FONT>");\r
111                 }\r
112         }\r
113          else\r
114         {\r
115                 // Wrong call!\r
116                 define('__BONUS_MSG', "<FONT class=\"guest_failed\">".BONUS_SHOW_WRONG_CALL."</FONT>");\r
117         }\r
118 \r
119         // Load send_bonus header template (for your banners, e.g.?)\r
120         define('__BONUS_HEADER', LOAD_TEMPLATE("show_bonus_header", true));\r
121 \r
122         // Load show_bonus footer template (for your banners, e.g.?)\r
123         define('__BONUS_FOOTER', LOAD_TEMPLATE("show_bonus_footer", true));\r
124 \r
125         // Total ranks who can win\r
126         define('__BONUS_TOTAL_RANKS', $CONFIG['bonus_ranks']);\r
127 \r
128         // Load final template\r
129         LOAD_TEMPLATE("show_bonus");\r
130 \r
131         // Include footer\r
132         include(PATH."inc/footer.php");\r
133 }\r
134  else\r
135 {\r
136         // You have to configure first!\r
137         LOAD_URL(URL."/install.php");\r
138 }\r
139 // Really all done here... ;-)\r
140 ?>\r