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 * -------------------------------------------------------------------- *
13 * Copyright (c) 2003 - 2009 by Roland Haeder *
14 * Copyright (c) 2009 - 2016 by Mailer Developer Team *
15 * For more information visit: http://mxchange.org *
17 * This program is free software; you can redistribute it and/or modify *
18 * it under the terms of the GNU General Public License as published by *
19 * the Free Software Foundation; either version 2 of the License, or *
20 * (at your option) any later version. *
22 * This program is distributed in the hope that it will be useful, *
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
25 * GNU General Public License for more details. *
27 * You should have received a copy of the GNU General Public License *
28 * along with this program; if not, write to the Free Software *
29 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
31 ************************************************************************/
33 // Load security stuff here
34 require('inc/libs/security_functions.php');
37 $GLOBALS['__start_time'] = microtime(TRUE);
40 $GLOBALS['__module'] = 'birthday_confirm';
41 $GLOBALS['__output_mode'] = '0';
43 // Initialize application
44 require('inc/init.php');
47 setContentType('text/html');
49 // Is the 'birthday' extension active?
50 redirectOnUninstalledExtension('birthday');
52 // Script is installed so let's check for his confirmation link...
53 $userid = bigintval(getRequestElement('userid'));
55 // Only allow numbers here...
56 $chk = bigintval(getRequestElement('check'), FALSE);
58 // Check if link is not clicked so far
59 $result = sqlQueryEscaped("SELECT
68 `{?_MYSQL_PREFIX?}_user_birthday` AS `b`
70 `{?_MYSQL_PREFIX?}_user_data` AS `d`
72 `b`.`userid`=`d`.`userid`
80 ), __FILE__, __LINE__);
81 //* DEBUG: */ debugOutput("userid=".$userid.",chk=".$chk." (".strlen($chk).'/'.strlen(getRequestElement('check')).'/'.sqlNumRows($result) . ')');
87 if (sqlNumRows($result) == 1) {
88 // Ok, congratulation again! Here's your gift from us...
89 $data = sqlFetchArray($result, FALSE);
91 // Is the account confirmed?
92 if ($data['status'] == 'CONFIRMED') {
93 // Add points to account
95 addPointsThroughReferralSystem('birthday_confirm', $userid, $data['points']);
97 // Remove entry from table
98 sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_birthday` WHERE `userid`=%s AND `chk_value`='%s' LIMIT 1",
99 array($userid, $chk), __FILE__, __LINE__);
101 // Load message from template
102 $content['message'] = loadTemplate('birthday_msg', TRUE, $data);
104 // Unconfirmed / locked accounts cannot get points
105 $content['message'] = '{%message,MEMBER_BIRTHDAY_CANNOT_STATUS=' . $data['status'] . '%}';
109 $content['message'] = '{--MEMBER_BIRTHDAY_CANNOT_LOAD_DATA--}';
113 sqlFreeResult($result);
115 // Set this because there is no module in URI
116 $GLOBALS['__module'] = 'birthday_confirm';
121 // Load final template and output it
122 loadTemplate('birthday_confirm', FALSE, $content);