2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 10/03/2004 *
4 * =================== Last change: 10/03/2004 *
6 * -------------------------------------------------------------------- *
7 * File : birthday_confirm.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Birthday bonus confirmation link *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Geburtstagsgutschrift bestaetigen *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2012 by Mailer Developer Team *
20 * For more information visit: http://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 // Load security stuff here
39 require('inc/libs/security_functions.php');
42 $GLOBALS['__start_time'] = microtime(true);
45 $GLOBALS['__module'] = 'birthday_confirm';
46 $GLOBALS['__output_mode'] = '0';
48 // Load the required file(s)
49 require('inc/config-global.php');
52 setContentType('text/html');
54 // Is the 'birthday' extension active?
55 redirectOnUninstalledExtension('birthday');
57 // Script is installed so let's check for his confirmation link...
58 $userid = bigintval(getRequestElement('userid'));
60 // Only allow numbers here...
61 $chk = bigintval(getRequestElement('check'), false);
63 // Check if link is not clicked so far
64 $result = SQL_QUERY_ESC("SELECT
65 b.`points`, d.`userid`, d.`gender`, d.`surname`, d.`family`, d.`status`, d.`ref_payout`
67 `{?_MYSQL_PREFIX?}_user_birthday` AS b
69 `{?_MYSQL_PREFIX?}_user_data` AS d
79 ), __FILE__, __LINE__);
80 //* DEBUG: */ debugOutput("userid=".$userid.",chk=".$chk." (".strlen($chk).'/'.strlen(getRequestElement('check')).'/'.SQL_NUMROWS($result) . ')');
86 if (SQL_NUMROWS($result) == 1) {
87 // Ok, congratulation again! Here's your gift from us...
88 $data = SQL_FETCHARRAY($result, false);
90 // Is the account confirmed?
91 if ($data['status'] == 'CONFIRMED') {
92 // Add points to account
94 addPointsThroughReferralSystem('birthday_confirm', $userid, $data['points']);
96 // Remove entry from table
97 SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_birthday` WHERE `userid`=%s AND `chk_value`='%s' LIMIT 1",
98 array($userid, $chk), __FILE__, __LINE__);
100 // Load message from template
101 $content['message'] = loadTemplate('birthday_msg', true, $data);
103 // Unconfirmed / locked accounts cannot get points
104 $content['message'] = '{%message,MEMBER_BIRTHDAY_CANNOT_STATUS=' . $data['status'] . '%}';
108 $content['message'] = '{--MEMBER_BIRTHDAY_CANNOT_LOAD_DATA--}';
112 SQL_FREERESULT($result);
114 // Set this because we have no module in URI
115 $GLOBALS['__module'] = 'birthday_confirm';
118 loadIncludeOnce('inc/header.php');
120 // Load birthday header template (for your banners, e.g.?)
121 $content['header'] = loadTemplate('birthday_header', true);
123 // Load birthday footer template (for your banners, e.g.?)
124 $content['footer'] = loadTemplate('birthday_footer', true);
126 // Load final template and output it
127 loadTemplate('birthday_confirm', false, $content);
130 loadIncludeOnce('inc/footer.php');