Security line in all includes changed
[mailer.git] / inc / modules / admin / what-list_doubler.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 02/12/2004 *
4  * ================                             Last change: 02/12/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-list_doubler.php                            *
8  * -------------------------------------------------------------------- *
9  * Short description : List doubler entries                             *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Verdoppler-Eintraege auflisten                   *
12  * -------------------------------------------------------------------- *
13  *                                                                      *
14  * -------------------------------------------------------------------- *
15  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
16  * For more information visit: http://www.mxchange.org                  *
17  *                                                                      *
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.                                  *
22  *                                                                      *
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.                         *
27  *                                                                      *
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,               *
31  * MA  02110-1301  USA                                                  *
32  ************************************************************************/
33
34 // Some security stuff...
35 if ((!defined('__SECURITY')) || (!is_admin())) {
36         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
37         require($INC);
38 }
39
40 // Add description as navigation point
41 ADD_DESCR("admin", basename(__FILE__));
42
43 if (empty($_GET['mode'])) {
44         // Chosse the overview page as default
45         $_GET['mode'] = "overview";
46 } else {
47         // Set table title automatically
48         if (empty($_GET['select'])) $_GET['select'] = "all";
49         $eval = "define('__ADMIN_DOUBLER_LIST_".strtoupper($_GET['mode'])."', ADMIN_DOUBLER_LIST_".strtoupper($_GET['mode'])."_".strtoupper($_GET['select']).");";
50         eval($eval);
51 }
52
53 // Load data for the template
54 switch ($_GET['mode'])
55 {
56 case "already":  // Already payed out points
57         break;
58
59 case "overview": // General overview page
60         $SUM_ALREADY = 0; $SUM_WAITING = 0;
61         // Number of direct already payouts and referral
62         $result = SQL_QUERY("SELECT COUNT(id) FROM "._MYSQL_PREFIX."_doubler WHERE completed='Y' AND is_ref='N'", __FILE__, __LINE__);
63         list($cnt) = SQL_FETCHROW($result);
64         SQL_FREERESULT($result);
65
66         if ((empty($cnt)) || ($cnt == "0"))
67         {
68                 // Nothing payed out so far
69                 define('__DOUBLER_ALREADY_DIRECT_LINK', "0");
70         }
71          else
72         {
73                 // Something was payed out
74                 $SUM_ALREADY += $cnt;
75                 define('__DOUBLER_ALREADY_DIRECT_LINK', "<A href=\"".URL."/modules.php?module=admin&amp;what=list_doubler&amp;mode=already&amp;select=direct\">".$cnt."</A>");
76         }
77         $result = SQL_QUERY("SELECT COUNT(id) FROM "._MYSQL_PREFIX."_doubler WHERE completed='Y' AND is_ref='Y'", __FILE__, __LINE__);
78         list($cnt) = SQL_FETCHROW($result);
79         SQL_FREERESULT($result);
80
81         if ((empty($cnt)) || ($cnt == "0"))
82         {
83                 // Nothing payed out so far
84                 define('__DOUBLER_ALREADY_REF_LINK', "0");
85         }
86          else
87         {
88                 // Something was payed out
89                 $SUM_ALREADY += $cnt;
90                 define('__DOUBLER_ALREADY_REF_LINK', "<A href=\"".URL."/modules.php?module=admin&amp;what=list_doubler&amp;mode=already&amp;select=ref\">".$cnt."</A>");
91         }
92         define('__DOUBLER_ALREADY_ALL_LINK', "<A href=\"".URL."/modules.php?module=admin&amp;what=list_doubler&amp;mode=already&amp;select=all\">".$SUM_ALREADY."</A>");
93
94         // And the same for waiting pouts (direct and referral)
95         $result = SQL_QUERY("SELECT COUNT(id) FROM "._MYSQL_PREFIX."_doubler WHERE completed='N' AND is_ref='N'", __FILE__, __LINE__);
96         list($cnt) = SQL_FETCHROW($result);
97         SQL_FREERESULT($result);
98
99         if ((empty($cnt)) || ($cnt == "0"))
100         {
101                 // Nothing payed out so far
102                 define('__DOUBLER_WAITING_DIRECT_LINK', "0");
103         }
104          else
105         {
106                 // Something was payed out
107                 $SUM_WAITING += $cnt;
108                 define('__DOUBLER_WAITING_DIRECT_LINK', "<A href=\"".URL."/modules.php?module=admin&amp;what=list_doubler&amp;mode=waiting&amp;select=direct\">".$cnt."</A>");
109         }
110         $result = SQL_QUERY("SELECT COUNT(id) FROM "._MYSQL_PREFIX."_doubler WHERE completed='N' AND is_ref='Y'", __FILE__, __LINE__);
111         list($cnt) = SQL_FETCHROW($result);
112         SQL_FREERESULT($result);
113
114         if ((empty($cnt)) || ($cnt == "0"))
115         {
116                 // Nothing payed out so far
117                 define('__DOUBLER_WAITING_REF_LINK', "0");
118         }
119          else
120         {
121                 // Something was payed out
122                 $SUM_WAITING += $cnt;
123                 define('__DOUBLER_WAITING_REF_LINK', "<A href=\"".URL."/modules.php?module=admin&amp;what=list_doubler&amp;mode=waiting&amp;select=ref\">".$cnt."</A>");
124         }
125         define('__DOUBLER_WAITING_ALL_LINK', "<A href=\"".URL."/modules.php?module=admin&amp;what=list_doubler&amp;mode=waiting&amp;select=all\">".$SUM_WAITING."</A>");
126
127         // All data is loaded here...
128         break;
129 }
130
131 // Load mode template
132 LOAD_TEMPLATE("admin_list_doubler_".$_GET['mode']);
133
134 //
135 ?>