2 /************************************************************************
3 * MXChange v0.2.1 Start: 01/19/2006 *
4 * ================ Last change: 01/19/2006 *
6 * -------------------------------------------------------------------- *
7 * File : what-list_norefs.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Show all members w/o a referral *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Alle Mitgliederaccounts ohne Werber auflisten *
12 * -------------------------------------------------------------------- *
14 * -------------------------------------------------------------------- *
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
16 * For more information visit: http://www.mxchange.org *
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. *
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. *
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, *
32 ************************************************************************/
34 // Some security stuff...
35 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN())) {
36 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
38 } elseif ((!EXT_IS_ACTIVE("user")) || (GET_EXT_VERSION("user") == "")) {
40 ADD_FATAL(sprintf(EXTENSION_PROBLEM_NOT_INSTALLED, "user"));
44 // Add description as navigation point
45 ADD_DESCR("admin", basename(__FILE__));
47 $MORE = ", userid"; $colspan = "4"; // 27
48 if (EXT_IS_ACTIVE("nickname")) { $MORE = ", nickname"; }
50 if (empty($_GET['letter'])) { $_GET['letter'] = _ALL2; }
51 if (empty($_GET['sortby'])) { $_GET['sortby'] = "userid"; }
52 if (empty($_GET['page'])) { $_GET['page'] = "1"; }
55 $BASE = "<A href=\"".URL."/modules.php?module=admin";
57 $whereStatement = " WHERE refid='0'";
58 if (($_GET['letter'] != _ALL2) && ($_GET['letter'] != _OTHERS) && (!empty($_GET['letter'])))
60 // List only persons w
61 $whereStatement = " WHERE refid='0' AND family LIKE '".$_GET['letter']."%'";
63 if ($_GET['sortby'] == "family_name") $_GET['sortby'] = "family";
64 $SQL = "SELECT userid, gender, surname, family, email, REMOTE_ADDR, refid, status".$MORE." FROM "._MYSQL_PREFIX."_user_data".$whereStatement." ORDER BY ".$_GET['sortby'];
65 $result_master = SQL_QUERY($SQL, __FILE__, __LINE__);
67 // Calculate page count (0.5 fixes a bug with page count)
68 $PAGES = round(SQL_NUMROWS($result_master) / $_CONFIG['user_limit'] + 0.5);
70 if (empty($_GET['page'])) $_GET['page'] = "1";
71 if (empty($_GET['offset'])) $_GET['offset'] = $_CONFIG['user_limit'];
73 // Add limitation to SQL string and run him again
74 $SQL .= " LIMIT ".($_GET['offset'] * $_GET['page'] - $_GET['offset']).", ".$_GET['offset'];
75 $result = SQL_QUERY($SQL, __FILE__, __LINE__);
77 $result_user = SQL_QUERY("SELECT emails_sent FROM "._MYSQL_PREFIX."_user_data WHERE status='CONFIRMED'", __FILE__, __LINE__);
78 $user_count = SQL_NUMROWS($result_user);
79 SQL_FREERESULT($result_user);
81 if (SQL_NUMROWS($result_master) > 0)
84 SQL_FREERESULT($result_master);
86 // We have some (new?) registrations!
87 define('__COLSPAN1' , $colspan);
88 define('__COLSPAN2' , ($colspan + 2));
89 define('__USER_CNT' , $user_count);
90 define('__ALPHA_SORT', alpha($_GET['sortby'], $colspan, true));
91 define('__SORT_LINKS', SortLinks($_GET['letter'], $_GET['sortby'], $colspan, true));
94 define('__PAGE_NAV', ADD_PAGENAV($PAGES, $_CONFIG['user_limit'], true, $colspan, true));
98 // No page navigation is required
99 define('__PAGE_NAV', "");
102 // Column with nickname when nickname extension is present
103 if (EXT_IS_ACTIVE("nickname"))
105 // Nickname extension found
106 define('__NICKNAME_TH', " <TD class=\"admin_title bottom2\" align=\"center\">".NICKNAME."</TD>");
111 define('__NICKNAME_TH', "");
115 while (list($uid, $gender, $sname, $fname, $email, $IP, $ref, $status, $nick) = SQL_FETCHROW($result))
117 if ($ref > 0) $ref = ADMIN_USER_PROFILE_LINK($ref);
118 $LINKS = TRANSLATE_COMMA(GET_TOTAL_DATA($uid, "user_links", "id", "userid", true));
119 if ($LINKS > 0) $LINKS = $BASE."&what=list_links&u_id=".$uid."\">".$LINKS."</A>";
122 if ((empty($nick)) || ($uid == $nick)) $nick = "---";
124 // Transfer data to array
127 'uid' => ADMIN_USER_PROFILE_LINK($uid),
128 'gender' => TRANSLATE_GENDER($gender),
131 'email' => "<A href=\"".CREATE_EMAIL_LINK($email, "user_data")."\">".$email."</A>",
134 'status' => TRANSLATE_STATUS($status),
139 // Load row template and switch colors
140 $OUT .= LOAD_TEMPLATE("admin_list_user_row", true, $content);
145 SQL_FREERESULT($result);
147 define('__USER_ROWS', $OUT);
149 // Load main template
150 LOAD_TEMPLATE("admin_list_user");
153 SQL_FREERESULT($result_master);
157 // No one as registered so far! :-(
158 LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_ACCOUNT_NOREFS_404);