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 OPEN_TABLE("100%", "admin_content admin_content_align", "");
49 $MORE = ", userid"; $colspan = "4"; // 27
50 if (EXT_IS_ACTIVE("nickname")) { $MORE = ", nickname"; }
52 if (empty($_GET['letter'])) { $_GET['letter'] = _ALL2; }
53 if (empty($_GET['sortby'])) { $_GET['sortby'] = "userid"; }
54 if (empty($_GET['page'])) { $_GET['page'] = "1"; }
57 $BASE = "<A href=\"".URL."/modules.php?module=admin";
59 $WHERE = " WHERE refid='0'";
60 if (($_GET['letter'] != _ALL2) && ($_GET['letter'] != _OTHERS) && (!empty($_GET['letter'])))
62 // List only persons w
63 $WHERE = " WHERE refid='0' AND family LIKE '".$_GET['letter']."%'";
65 if ($_GET['sortby'] == "family_name") $_GET['sortby'] = "family";
66 $SQL = "SELECT userid, sex, surname, family, email, REMOTE_ADDR, refid, status".$MORE." FROM "._MYSQL_PREFIX."_user_data".$WHERE." ORDER BY ".$_GET['sortby'];
67 $result_master = SQL_QUERY($SQL, __FILE__, __LINE__);
69 // Calculate page count (0.5 fixes a bug with page count)
70 $PAGES = round(SQL_NUMROWS($result_master) / $CONFIG['user_limit'] + 0.5);
72 if (empty($_GET['page'])) $_GET['page'] = "1";
73 if (empty($_GET['offset'])) $_GET['offset'] = $CONFIG['user_limit'];
75 // Add limitation to SQL string and run him again
76 $SQL .= " LIMIT ".($_GET['offset'] * $_GET['page'] - $_GET['offset']).", ".$_GET['offset'];
77 $result = SQL_QUERY($SQL, __FILE__, __LINE__);
79 $result_user = SQL_QUERY("SELECT emails_sent FROM "._MYSQL_PREFIX."_user_data WHERE status='CONFIRMED'", __FILE__, __LINE__);
80 $user_count = SQL_NUMROWS($result_user);
81 SQL_FREERESULT($result_user);
83 if (SQL_NUMROWS($result_master) > 0)
86 SQL_FREERESULT($result_master);
88 // We have some (new?) registrations!
89 define('__COLSPAN1' , $colspan);
90 define('__COLSPAN2' , ($colspan + 2));
91 define('__USER_CNT' , $user_count);
92 define('__ALPHA_SORT', alpha($_GET['sortby'], $colspan, true));
93 define('__SORT_LINKS', SortLinks($_GET['letter'], $_GET['sortby'], $colspan, true));
96 define('__PAGE_NAV', ADD_PAGENAV($PAGES, $CONFIG['user_limit'], true, $colspan, true));
100 // No page navigation is required
101 define('__PAGE_NAV', "");
104 // Column with nickname when nickname extension is present
105 if (EXT_IS_ACTIVE("nickname"))
107 // Nickname extension found
108 define('__NICKNAME_TH', " <TD class=\"admin_title bottom2\" align=\"center\">".NICKNAME."</TD>");
113 define('__NICKNAME_TH', "");
117 while (list($uid, $sex, $sname, $fname, $email, $IP, $ref, $status, $nick) = SQL_FETCHROW($result))
119 if ($ref > 0) $ref = ADMIN_USER_PROFILE_LINK($ref);
120 $LINKS = TRANSLATE_COMMA(GET_TOTAL_DATA($uid, "user_links", "id", "userid", true));
121 if ($LINKS > 0) $LINKS = $BASE."&what=list_links&u_id=".$uid."\">".$LINKS."</A>";
124 if ((empty($nick)) || ($uid == $nick)) $nick = "---";
126 // Transfer data to array
129 'uid' => ADMIN_USER_PROFILE_LINK($uid),
130 'sex' => TRANSLATE_SEX($sex),
133 'email' => "<A href=\"".CREATE_EMAIL_LINK($email, "user_data")."\">".$email."</A>",
136 'status' => TRANSLATE_STATUS($status),
141 // Load row template and switch colors
142 $OUT .= LOAD_TEMPLATE("admin_list_user_row", true, $content);
147 SQL_FREERESULT($result);
149 define('__USER_ROWS', $OUT);
151 // Load main template
152 LOAD_TEMPLATE("admin_list_user");
155 SQL_FREERESULT($result_master);
159 // No one as registered so far! :-(
160 LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_ACCOUNT_NOREFS_404);