branch prepared
[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 ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!is_admin()))
36 {
37         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
38         require($INC);
39 }
40
41 // Add description as navigation point
42 ADD_DESCR("admin", basename(__FILE__));
43
44 if (empty($_GET['mode']))
45 {
46         // Chosse the overview page as default
47         $_GET['mode'] = "overview";
48 }
49  else
50 {
51         // Set table title automatically
52         if (empty($_GET['select'])) $_GET['select'] = "all";
53         $eval = "define('__ADMIN_DOUBLER_LIST_".strtoupper($_GET['mode'])."', ADMIN_DOUBLER_LIST_".strtoupper($_GET['mode'])."_".strtoupper($_GET['select']).");";
54         eval($eval);
55 }
56
57 // Load data for the template
58 switch ($_GET['mode'])
59 {
60 case "already":  // Already payed out points
61         break;
62
63 case "overview": // General overview page
64         $SUM_ALREADY = 0; $SUM_WAITING = 0;
65         // Number of direct already payouts and referral
66         $result = SQL_QUERY("SELECT COUNT(id) FROM "._MYSQL_PREFIX."_doubler WHERE completed='Y' AND is_ref='N'", __FILE__, __LINE__);
67         list($cnt) = SQL_FETCHROW($result);
68         SQL_FREERESULT($result);
69
70         if ((empty($cnt)) || ($cnt == "0"))
71         {
72                 // Nothing payed out so far
73                 define('__DOUBLER_ALREADY_DIRECT_LINK', "0");
74         }
75          else
76         {
77                 // Something was payed out
78                 $SUM_ALREADY += $cnt;
79                 define('__DOUBLER_ALREADY_DIRECT_LINK', "<A href=\"".URL."/modules.php?module=admin&amp;what=list_doubler&amp;mode=already&amp;select=direct\">".$cnt."</A>");
80         }
81         $result = SQL_QUERY("SELECT COUNT(id) FROM "._MYSQL_PREFIX."_doubler WHERE completed='Y' AND is_ref='Y'", __FILE__, __LINE__);
82         list($cnt) = SQL_FETCHROW($result);
83         SQL_FREERESULT($result);
84
85         if ((empty($cnt)) || ($cnt == "0"))
86         {
87                 // Nothing payed out so far
88                 define('__DOUBLER_ALREADY_REF_LINK', "0");
89         }
90          else
91         {
92                 // Something was payed out
93                 $SUM_ALREADY += $cnt;
94                 define('__DOUBLER_ALREADY_REF_LINK', "<A href=\"".URL."/modules.php?module=admin&amp;what=list_doubler&amp;mode=already&amp;select=ref\">".$cnt."</A>");
95         }
96         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>");
97
98         // And the same for waiting pouts (direct and referral)
99         $result = SQL_QUERY("SELECT COUNT(id) FROM "._MYSQL_PREFIX."_doubler WHERE completed='N' AND is_ref='N'", __FILE__, __LINE__);
100         list($cnt) = SQL_FETCHROW($result);
101         SQL_FREERESULT($result);
102
103         if ((empty($cnt)) || ($cnt == "0"))
104         {
105                 // Nothing payed out so far
106                 define('__DOUBLER_WAITING_DIRECT_LINK', "0");
107         }
108          else
109         {
110                 // Something was payed out
111                 $SUM_WAITING += $cnt;
112                 define('__DOUBLER_WAITING_DIRECT_LINK', "<A href=\"".URL."/modules.php?module=admin&amp;what=list_doubler&amp;mode=waiting&amp;select=direct\">".$cnt."</A>");
113         }
114         $result = SQL_QUERY("SELECT COUNT(id) FROM "._MYSQL_PREFIX."_doubler WHERE completed='N' AND is_ref='Y'", __FILE__, __LINE__);
115         list($cnt) = SQL_FETCHROW($result);
116         SQL_FREERESULT($result);
117
118         if ((empty($cnt)) || ($cnt == "0"))
119         {
120                 // Nothing payed out so far
121                 define('__DOUBLER_WAITING_REF_LINK', "0");
122         }
123          else
124         {
125                 // Something was payed out
126                 $SUM_WAITING += $cnt;
127                 define('__DOUBLER_WAITING_REF_LINK', "<A href=\"".URL."/modules.php?module=admin&amp;what=list_doubler&amp;mode=waiting&amp;select=ref\">".$cnt."</A>");
128         }
129         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>");
130
131         // All data is loaded here...
132         break;
133 }
134
135 // Load mode template
136 LOAD_TEMPLATE("admin_list_doubler_".$_GET['mode']);
137
138 //
139 ?>