Again redirection should work
[mailer.git] / lead-confirm.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 05/14/2007 *
4  * ===============                              Last change: 05/14/2007 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : lead-confirm.php                                 *
8  * -------------------------------------------------------------------- *
9  * Short description : Script for lead-campaign codes                   *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Alles um den Bestaetigungslink                   *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
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 - 2008 by Roland Haeder                           *
21  * For more information visit: http://www.mxchange.org                  *
22  *                                                                      *
23  * This program is free software; you can redistribute it and/or modify *
24  * it under the terms of the GNU General Public License as published by *
25  * the Free Software Foundation; either version 2 of the License, or    *
26  * (at your option) any later version.                                  *
27  *                                                                      *
28  * This program is distributed in the hope that it will be useful,      *
29  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
30  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
31  * GNU General Public License for more details.                         *
32  *                                                                      *
33  * You should have received a copy of the GNU General Public License    *
34  * along with this program; if not, write to the Free Software          *
35  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
36  * MA  02110-1301  USA                                                  *
37  ************************************************************************/
38
39 // Load security stuff here
40 require('inc/libs/security_functions.php');
41
42 // Init "action" and "what"
43 $GLOBALS['startTime'] = microtime(true);
44 $GLOBALS['what'] = '';
45 $GLOBALS['action'] = '';
46
47 // Set module
48 $GLOBALS['module'] = 'lead-confirm';
49
50 // Set "CSS-Mode"
51 $GLOBALS['output_mode'] = '0';
52
53 // Load config.php
54 require('inc/config-global.php');
55
56 // Is the script installed?
57 if (isInstalled()) {
58         // Header
59         loadIncludeOnce('inc/header.php');
60
61         // Initialize the array for the template
62         $content = array(
63                 'lead_uid'   => -1,
64                 'lead_email' => 'INVALID@EMAIL'
65                 );
66
67                 // Is the cookie set?
68                 if (isSessionVariableSet('lead_uid')) {
69                         // Is the user-account unlocked and valid?
70                         $result = SQL_QUERY_ESC("SELECT email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1",
71                         array(bigintval(getSession('lead_uid'))), __FILE__, __LINE__);
72                         if (SQL_NUMROWS($result) == 1) {
73                                 // Secure the ID number
74                                 $content['lead_uid'] = bigintval(getSession('lead_uid'));
75
76                                 // Load the email address
77                                 list($email) = SQL_FETCHROW($result);
78
79                                 // Compile email
80                                 $content['lead_email'] = COMPILE_CODE($email);
81                         } else {
82                                 // Not found!
83                                 $content['lead_uid'] = 0;
84                         }
85                 } else {
86                         // Maybe spider?
87                         $content['lead_email'] = constant('WEBMASTER');
88                 }
89
90                 // Load the lead template
91                 LOAD_TEMPLATE('lead_code', false, $content);
92
93                 // Footer
94                 loadIncludeOnce('inc/footer.php');
95 } else {
96         // You have to install first!
97         redirectToUrl('install.php');
98 }
99
100 // All done here...
101 shutdown();
102
103 //
104 ?>