2 /************************************************************************
3 * MXChange v0.2.1 Start: 01/28/2004 *
4 * ================ Last change: 06/10/2004 *
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 * -------------------------------------------------------------------- *
14 * Mod created by : Lars Moehlenbruch ( http://www.surfo.net ) *
16 * -------------------------------------------------------------------- *
18 * Highly modified by Roland Haeder *
20 * -------------------------------------------------------------------- *
21 * Copyright (c) 2003 - 2008 by Roland Haeder *
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 // Some security stuff...
41 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN()))
43 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
47 // Add description as navigation point
48 ADD_DESCR("admin", basename(__FILE__));
50 if (!empty($_GET['u_id']))
52 // Check if the user already exists
53 $result = SQL_QUERY_ESC("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1",
54 array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
55 if (SQL_NUMROWS($result) == 1)
58 SQL_FREERESULT($result);
60 // Loads surname, family's name and the email address
61 $result = SQL_QUERY_ESC("SELECT COUNT(*) FROM "._MYSQL_PREFIX."_user_data WHERE refid=%s",
62 array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
63 $result_lck = SQL_QUERY_ESC("SELECT COUNT(*) FROM "._MYSQL_PREFIX."_user_data WHERE refid=%s AND status != 'CONFIRMED' ORDER BY userid",
64 array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
65 $menge = SQL_RESULT($result , 0, 0);
66 $menge_lck = SQL_RESULT($result_lck, 0, 0);
69 SQL_FREERESULT($result);
70 SQL_FREERESULT($result_lck);
72 $result = SQL_QUERY_ESC("SELECT userid, sex, surname, family, email, status, joined FROM "._MYSQL_PREFIX."_user_data WHERE refid=%s ORDER BY userid",
73 array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
75 OUTPUT_HTML(ADMIN_TOTAL_REFS_1."".ADMIN_USER_PROFILE_LINK($_GET['u_id'])."".ADMIN_TOTAL_REFS_2.$menge.ADMIN_TOTAL_REFS_3.$menge_lck.ADMIN_TOTAL_REFS_4."<br /><br />");
78 $rows = SQL_NUMROWS($result);
83 while ($row = SQL_FETCHROW($result))
85 // Check for referrals
86 $result_refs = SQL_QUERY_ESC("SELECT COUNT(userid) FROM "._MYSQL_PREFIX."_user_data WHERE refid=%s",
87 array(bigintval($row[0])), __FILE__, __LINE__);
88 $refs_cnt = SQL_RESULT($result_refs, 0, 0);
89 SQL_FREERESULT($result_refs);
91 // Prepare data for the template
94 'u_link' => ADMIN_USER_PROFILE_LINK($row[0]),
95 'salut' => TRANSLATE_SEX($row[1]),
99 'email' => "<A href=\"".CREATE_EMAIL_LINK($row[4], "user_data")."\">".$row[4]."</A>",
100 'status' => TRANSLATE_STATUS($row[5]),
101 'registered' => MAKE_DATETIME($row[6], "3"),
104 // Check if referral count is larger 0 and update link
105 if ($refs_cnt > 0) $content['refs_link'] = ADMIN_USER_PROFILE_LINK($row[0], $refs_cnt, "list_refs");
107 // Load row template and switch color
108 $OUT .= LOAD_TEMPLATE("admin_list_refs_row", true, $content);
113 SQL_FREERESULT($result);
114 define('__REF_ROWS', $OUT);
116 // Load main template
117 LOAD_TEMPLATE("admin_list_refs");
122 // No referrals made so far
123 LOAD_TEMPLATE("admin_settings_saved", false, USER_REF_404);
129 LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_MEMBER_404_1.$_GET['u_id'].ADMIN_MEMBER_404_2);
134 // Output selection form with all confirmed user accounts listed
135 ADD_MEMBER_SELECTION_BOX();