2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 10/13/2003 *
4 * =================== Last change: 09/04/2004 *
6 * -------------------------------------------------------------------- *
8 * -------------------------------------------------------------------- *
9 * Short description : Redirection for the referal link *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Weiterleitungsscript fuer die Referal-Links *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * Needs to be in all Files and every File needs "svn propset *
18 * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
19 * -------------------------------------------------------------------- *
20 * Copyright (c) 2003 - 2009 by Roland Haeder *
21 * Copyright (c) 2009, 2010 by Mailer Developer Team *
22 * For more information visit: http://www.mxchange.org *
24 * This program is free software; you can redistribute it and/or modify *
25 * it under the terms of the GNU General Public License as published by *
26 * the Free Software Foundation; either version 2 of the License, or *
27 * (at your option) any later version. *
29 * This program is distributed in the hope that it will be useful, *
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
32 * GNU General Public License for more details. *
34 * You should have received a copy of the GNU General Public License *
35 * along with this program; if not, write to the Free Software *
36 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
38 ************************************************************************/
40 // Load security stuff here
41 require('inc/libs/security_functions.php');
44 $GLOBALS['module'] = 'ref';
45 $GLOBALS['output_mode'] = -1;
47 // Load the required file(s)
48 require('inc/config-global.php');
50 // Set content type for e.g. search engines
51 setContentType('text/html');
53 // No refid by default
54 $URL = 'modules.php?module=index';
56 if (determineReferalId() != 0) {
57 // Test if nickname or numeric id
58 if (isExtensionActive('nickname')) {
59 // Nickname in URL, so load the id
60 fetchUserData(determineReferalId(), 'nickname');
62 // Do we have an entry?
63 if (isUserDataValid()) {
65 $GLOBALS['refid'] = getUserData('userid');
67 // So do we have a userid?
68 fetchUserData(determineReferalId());
70 // Do we have an entry?
71 if (!isUserDataValid()) {
72 // No entry, so no referal id
73 $GLOBALS['refid'] = getConfig('def_refid');
79 setSession('refid', determineReferalId());
81 // Is the refid valid?
82 if (isValidUserId(determineReferalId())) {
84 SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `ref_clicks`=`ref_clicks`+1 WHERE `userid`=%s LIMIT 1",
85 array(determineReferalId()), __FILE__, __LINE__);
87 // Base URL for redirection
88 switch (getConfig('refid_target')) {
90 $URL = 'modules.php?module=index&what=register';
94 $URL = 'modules.php?module=index';