require "include/bittorrent.php"; dbconn(); loggedinorreturn(); $search = trim($_GET['search']); $class = $_GET['class']; if ($class == '-' || !is_valid_id($class)) $class = ''; if ($search != '' || $class) { $query = "username LIKE " . sqlesc("%$search%") . " AND status='confirmed'"; if ($search) $q = "search=" . htmlspecialchars($search); } else { $letter = trim($_GET["letter"]); if (strlen($letter) > 1) stderr( _("Error"), "Invalid input"); if ($letter == "" || strpos("abcdefghijklmnopqrstuvwxyz", $letter) === false) $letter = "a"; $query = "username LIKE '$letter%' AND status='confirmed'"; $q = "letter=$letter"; } if ($class) { $query .= " AND class=$class"; $q .= ($q ? "&" : "") . "class=$class"; } stdhead("Users"); print("
\n"); for ($i = 97; $i < 123; ++$i) { $l = chr($i); $L = chr($i - 32); if ($l == $letter) print("$L\n"); else print("$L\n"); } print("
\n"); $page = (int) $_GET['page']; $perpage = 100; $offset = ($page * $perpage) - $perpage; if($offset < 0) $offset = 0; $country_sql = "concat('')"; $sql = sprintf('SELECT SQL_CALC_FOUND_ROWS users.id as id, users.username as username, users.class as class, IF ( users.country >0, %s, \'---\' ) as country, IF ( users.added = "0000-00-00 00:00:00", "-", users.added ) as added, IF ( users.last_access = "0000-00-00 00:00:00", "-", users.last_access ) as last_access FROM users USE INDEX( username_status) LEFT JOIN countries ON users.country = countries.id WHERE %s ORDER BY username LIMIT %u,%u', $country_sql, $query, $offset, $perpage); $res = do_mysql_query($sql) or sqlerr(); $count = mysql_result( do_mysql_query('SELECT FOUND_ROWS()'), 0); $pages = floor($count / $perpage); if ($pages * $perpage < $arr[0]) ++$pages; if ($page < 1) $page = 1; if ($page > $pages) $page = $pages; for ($i = 1; $i <= $pages; ++$i) if ($i == $page) $pagemenu .= "$i\n"; else $pagemenu .= "$i\n"; if ($page == 1) $browsemenu .= "<< Prev"; else $browsemenu .= "<< Prev"; $browsemenu .= " "; if ($page == $pages) $browsemenu .= "Next >>"; else $browsemenu .= "Next >>"; print("$browsemenu
$pagemenu
User name | Registered | Last access | Class | Country |
'.$arr['username'].''.($arr['donated'] > 0 ? "" : "")." | " . ''.$arr['added'].' | '.$arr['last_access'].' | '. get_user_class_name($arr['class']) . ' | '.$arr['country'].' |
'.$pagemenu.'
'.$browsemenu.'