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 OPEN_TABLE("100%", "admin_content admin_content_align", "");
51 if (!empty($_GET['u_id']))
53 // Check if the user already exists
54 $result = SQL_QUERY_ESC("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d LIMIT 1",
55 array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
56 if (SQL_NUMROWS($result) == 1)
59 SQL_FREERESULT($result);
61 // Loads surname, family's name and the email address
62 $result = SQL_QUERY_ESC("SELECT COUNT(*) FROM "._MYSQL_PREFIX."_user_data WHERE refid=%d",
63 array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
64 $result_lck = SQL_QUERY_ESC("SELECT COUNT(*) FROM "._MYSQL_PREFIX."_user_data WHERE refid=%d AND status != 'CONFIRMED' ORDER BY userid",
65 array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
66 $menge = SQL_RESULT($result , 0, 0);
67 $menge_lck = SQL_RESULT($result_lck, 0, 0);
70 SQL_FREERESULT($result);
71 SQL_FREERESULT($result_lck);
73 $result = SQL_QUERY_ESC("SELECT userid, sex, surname, family, email, status, joined FROM "._MYSQL_PREFIX."_user_data WHERE refid=%d ORDER BY userid",
74 array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
76 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 />");
79 $rows = SQL_NUMROWS($result);
84 while ($row = SQL_FETCHROW($result))
86 // Check for referrals
87 $result_refs = SQL_QUERY_ESC("SELECT COUNT(userid) FROM "._MYSQL_PREFIX."_user_data WHERE refid=%d",
88 array(bigintval($row[0])), __FILE__, __LINE__);
89 $refs_cnt = SQL_RESULT($result_refs, 0, 0);
90 SQL_FREERESULT($result_refs);
92 // Prepare data for the template
95 'u_link' => ADMIN_USER_PROFILE_LINK($row[0]),
96 'salut' => TRANSLATE_SEX($row[1]),
100 'email' => "<A href=\"".CREATE_EMAIL_LINK($row[4], "user_data")."\">".$row[4]."</A>",
101 'status' => TRANSLATE_STATUS($row[5]),
102 'registered' => MAKE_DATETIME($row[6], "3"),
105 // Check if referral count is larger 0 and update link
106 if ($refs_cnt > 0) $content['refs_link'] = ADMIN_USER_PROFILE_LINK($row[0], $refs_cnt, "list_refs");
108 // Load row template and switch color
109 $OUT .= LOAD_TEMPLATE("admin_list_refs_row", true, $content);
114 SQL_FREERESULT($result);
115 define('__REF_ROWS', $OUT);
117 // Load main template
118 LOAD_TEMPLATE("admin_list_refs");
123 // No referrals made so far
124 LOAD_TEMPLATE("admin_settings_saved", false, USER_REF_404);
130 LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_MEMBER_404_1.$_GET['u_id'].ADMIN_MEMBER_404_2);
135 // Output selection form with all confirmed user accounts listed
136 ADD_MEMBER_SELECTION_BOX();