Refback will be payed now (user cannot setup currently)
[mailer.git] / inc / modules / admin / what-list_refs.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 01/28/2004 *
4  * ================                             Last change: 06/10/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-list_refs.php                               *
8  * -------------------------------------------------------------------- *
9  * Short description : Show all referrals made by a member              *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Alle generierten Refs eines Mitgliedes anzeigen  *
12  * -------------------------------------------------------------------- *
13  *                                                                      *
14  *    Mod created by : Lars Moehlenbruch ( http://www.surfo.net )       *
15  *                                                                      *
16  * -------------------------------------------------------------------- *
17  *                                                                      *
18  *                 Highly modified by Roland Haeder                     *
19  *                                                                      *
20  * -------------------------------------------------------------------- *
21  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
22  * For more information visit: http://www.mxchange.org                  *
23  *                                                                      *
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.                                  *
28  *                                                                      *
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.                         *
33  *                                                                      *
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,               *
37  * MA  02110-1301  USA                                                  *
38  ************************************************************************/
39
40 // Some security stuff...
41 if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
42         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
43         require($INC);
44 }
45
46 // Add description as navigation point
47 ADD_DESCR("admin", basename(__FILE__));
48
49 if (!empty($_GET['u_id'])) {
50         // Check if the user already exists
51         $result = SQL_QUERY_ESC("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1",
52          array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
53         if (SQL_NUMROWS($result) == 1) {
54                 // Load all referal levels
55                 $result_levels = SQL_QUERY_ESC("SELECT d.level, d.percents, r.counter
56 FROM "._MYSQL_PREFIX."_refdepths AS d
57 LEFT JOIN "._MYSQL_PREFIX."_refsystem AS r
58 ON d.level=r.level
59 WHERE r.userid=%s
60 ORDER BY d.level ASC",
61                         array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
62
63                 // Are there some levels (VERY BAD IF NONE!)
64                 if (SQL_NUMROWS($result_levels) > 0) {
65                         // List all ref levels
66                         $OUT = ""; $SW = 2;
67                         while ($levels = SQL_FETCHARRAY($result_levels)) {
68                                 // Insert more data
69                                 $levels['sw']    = $SW;
70                                 $levels['level'] = ($levels['level'] + 1);
71
72                                 // Load all refs of this user
73                                 //$result_refs = SQL_QUERY_ESC("SELECT 
74                                 // Load level template
75                                 $OUT .= LOAD_TEMPLATE("admin_list_refs_level", true, $levels);
76
77                                 // Switch colors
78                                 $SW = 3 - $SW;
79                         } // END - if
80
81                         // Prepare content
82                         $content = array(
83                                 'rows' => $OUT,
84                                 'uid'  => ADMIN_USER_PROFILE_LINK($_GET['u_id'])
85                         );
86
87                         // Load mein template
88                         LOAD_TEMPLATE("admin_list_refs", false, $content);
89                 } else {
90                         // No levels found, very bad!
91                         LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_NO_REF_LEVELS);
92                 }
93
94                 // Free result
95                 SQL_FREERESULT($result_levels);
96         } else {
97                 // User not found
98                 LOAD_TEMPLATE("admin_settings_saved", false, sprintf(ADMIN_MEMBER_404, $_GET['u_id']));
99         }
100
101         // Free memory
102         SQL_FREERESULT($result);
103 } else {
104         // Output selection form with all confirmed user accounts listed
105         ADD_MEMBER_SELECTION_BOX();
106 }
107
108 //
109 ?>