2 /************************************************************************
3 * MXChange v0.2.1 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 * -------------------------------------------------------------------- *
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;
39 $GLOBALS['what'] = ""; $GLOBALS['action'] = "";
42 $GLOBALS['module'] = "birthday_confirm"; $CSS = -1;
44 // Load the required file(s)
45 require ("inc/config.php");
47 if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_installed')))
49 // Script is installed so let's check for his confirmation link...
50 $uid = strip_tags(bigintval($_GET['uid']));
52 // Only allow numbers here...
53 $chk = strip_tags(bigintval($_GET['check'], false));
55 // Check if link is not clicked so far
56 $result = SQL_QUERY_ESC("SELECT DISTINCT b.points, d.sex, d.surname, d.family, d.status
57 FROM "._MYSQL_PREFIX."_user_birthday AS b
58 LEFT JOIN "._MYSQL_PREFIX."_user_data AS d
60 WHERE b.userid=%d AND b.chk_value=%d LIMIT 1",
61 array($uid, $chk), __FILE__, __LINE__);
63 if (SQL_NUMROWS($result) == 1)
65 // Ok, congratulation again! Here's your gift from us...
66 list($gift, $salut, $sname, $fname, $status) = SQL_FETCHROW($result);
67 if ($status == "CONFIRMED")
69 // Set mode depending on how many mails the member has to confirm
71 if (($ref_payout > 0) && ($_CONFIG['allow_direct_pay'] == 'N')) $locked = true;
73 // Add points to account
75 ADD_POINTS_REFSYSTEM($uid, $gift, false, "0", $locked, strtolower($_CONFIG['birthday_mode']));
77 // Remove entry from table
78 $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_birthday WHERE userid=%d LIMIT 1",
79 array($uid), __FILE__, __LINE__);
81 // Update mediadata if version is 0.0.4 or newer
82 if (GET_EXT_VERSION("mediadata") >= "0.0.4")
85 MEDIA_UPDATE_ENTRY(array("total_points"), "add", $gift);
88 // Transfer data to constants for the template
89 define('__SALUT', TRANSLATE_SEX($salut));
90 define('__SNAME', $sname);
91 define('__FNAME', $fname);
92 define('__GIFT' , $gift);
94 // Load message from template
95 define('__MSG', LOAD_TEMPLATE("birthday_msg", true));
99 // Unconfirmed / locked accounts cannot get points
100 define('__MSG', BIRTHDAY_CANNOT_STATUS_1.TRANSLATE_STATUS($status).BIRTHDAY_CANNOT_STATUS_2);
106 define('__MSG', BIRTHDAY_CANNOT_LOAD_DATA);
110 SQL_FREERESULT($result);
112 // Set this because we have no module in URI
113 $GLOBALS['module'] = "birthday_confirm";
116 include(PATH."inc/header.php");
118 // Load birthday header template (for your banners, e.g.?)
119 define('__BIRTHDAY_HEADER', LOAD_TEMPLATE("birthday_header", true));
121 // Load birthday footer template (for your banners, e.g.?)
122 define('__BIRTHDAY_FOOTER', LOAD_TEMPLATE("birthday_footer", true));
124 // Load final template and output it
125 LOAD_TEMPLATE("birthday_confirm");
128 include(PATH."inc/footer.php");
132 // You have to configure first!
133 LOAD_URL("install.php");
135 // Really all done here... ;-)