-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathusers.php
167 lines (150 loc) · 6.68 KB
/
users.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<?php
/*
// +--------------------------------------------------------------------------+
// | Project: NVTracker - NetVision BitTorrent Tracker |
// +--------------------------------------------------------------------------+
// | This file is part of NVTracker. NVTracker is based on BTSource, |
// | originally by RedBeard of TorrentBits, extensively modified by |
// | Gartenzwerg. |
// | |
// | NVTracker is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation; either version 2 of the License, or |
// | (at your option) any later version. |
// | |
// | NVTracker is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with NVTracker; if not, write to the Free Software Foundation, |
// | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +--------------------------------------------------------------------------+
// | Obige Zeilen dürfen nicht entfernt werden! Do not remove above lines! |
// +--------------------------------------------------------------------------+
*/
require "include/bittorrent.php";
userlogin();
loggedinorreturn();
$search = ((isset($_GET['search'])) ? trim($_GET['search']) : "");
$class = ((isset($_GET['class'])) ? $_GET['class'] : "");
$letter = ((isset($_GET["letter"])) ? trim($_GET["letter"]) : "");
$page = ((isset($_GET['page'])) ? $_GET['page'] : 0);
$class_options = "";
$browsemenu = "";
$pagemenu = "";
$q = "";
$perpage = 100;
if($class == '-' || !is_valid_id($class))
$class = '';
if($search != '' || $class){
$query = "username LIKE '%" . $search . "%' AND status='confirmed'";
if($search)
$q = "search=" . htmlspecialchars($search);
}else{
if(strlen($letter) > 1)
die;
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;
}
for($i = 0;$i<=UC_SYSOP;++$i){
if($c = get_user_class_name($i))
$class_options .= "<option value=\"" . $i . ($class && $class == $i ? " selected" : "") . "\">" . $c . "</option>";
}
$c = $database->row_count("users", $query);
$pages = floor($c / $perpage);
if($pages * $perpage < $c)
++$pages;
if($page < 1)
$page = 1;
elseif($page > $pages)
$page = $pages;
for($i = 1; $i <= $pages; ++$i){
if($i == $page)
$pagemenu .= "<b>" . $i . "</b>\n";
else
$pagemenu .= "<a href=" . $_SERVER["PHP_SELF"] . "?" . $q . "&page=" . $i . "><b>" . $i . "</b></a>\n";
}
if($page == 1)
$browsemenu .= "<b><< Zurück</b>";
else
$browsemenu .= "<a href=" . $_SERVER["PHP_SELF"] . "?" . $q . "&page=" . ($page - 1) . "><b><< Zurück</b></a>";
$browsemenu .= " ";
if($page == $pages)
$browsemenu .= "<b>Weiter >></b>";
else
$browsemenu .= "<a href=" . $_SERVER["PHP_SELF"] . "?" . $q . "&page=" . ($page + 1) . "><b>Weiter >></b></a>";
$offset = ($page * $perpage) - $perpage;
$sql = "SELECT u.*, c.name as cname, c.flagpic as cflagpic FROM users as u LEFT JOIN countries as c ON u.country = c.id WHERE " . $query . " ORDER BY username LIMIT " . $offset . "," . $perpage;
$qry = $GLOBALS['DB']->prepare($sql);
$qry->execute();
$user_num = $qry->rowCount();
$user_data = $qry->FetchAll();
stdhead("Benutzer");
begin_frame("<img src=\"".$GLOBALS["PIC_BASE_URL"]."user.png\" width=\"22\" height=\"22\" alt=\"\" style=\"vertical-align: middle;\"> Mitglieder", FALSE, "650px");
begin_table(TRUE);
echo "<tr>\n".
" <td class=\"tableb\" align=\"left\"><form method=\"get\" action=\"?\">Suchen: <input type=\"text\" size=\"30\" name=\"search\"> ".
"<select name=\"class\">".
"<option value=\"-\">(beliebige Klasse)</option>".
$class_options .
"</select> ".
"<input type=\"submit\" value=\"Okay\"></form></td>\n".
"</tr>\n".
"<tr>\n".
" <td class=\"tablea\" align=\"center\">";
for($i = 97; $i < 123; ++$i){
$l = chr($i);
$L = chr($i - 32);
if($l == $letter)
echo "<b>" . $L . "</b> ";
else
echo "<a href=" . $_SERVER["PHP_SELF"] . "?letter=" . $l . "><b>" . $L . "</b></a> ";
}
echo " </td>\n".
"</tr>\n".
"<tr>\n".
" <td class=\"tablea\" align=\"center\">" . $browsemenu . "<br>" . $pagemenu . "</td>\n".
"</tr>\n";
end_table();
begin_table(TRUE);
echo "<tr>\n".
" <td class=\"tablecat\" align=\"left\">Benutzername</td>\n".
" <td class=\"tablecat\">Registriert</td>\n".
" <td class=\"tablecat\">Letzter Zugriff</td>\n".
" <td class=\"tablecat\" align=\"left\">Klasse</td>\n".
" <td class=\"tablecat\">Land</td>\n".
"</tr>\n";
for($i = 0; $i < $user_num; ++$i){
$arr = $user_data[$i];
if($arr['country'] > 0)
$country = " <td class=\"tablea\" style=\"padding: 0px\" align=\"center\"><img src=\"" . $GLOBALS["PIC_BASE_URL"] . "flag/" . $arr["cflagpic"] . "\" alt=\"" . $arr["cname"] . "\"></td>\n";
else
$country = " <td class=\"tablea\" align=\"center\"> </td>\n";
if($arr['added'] == '0000-00-00 00:00:00')
$arr['added'] = '-';
if($arr['last_access'] == '0000-00-00 00:00:00')
$arr['last_access'] = '-';
echo "<tr>\n".
" <td class=\"tablea\" align=\"left\"><a href=\"userdetails.php?id=" . $arr["id"] . "\"><font class=\"".get_class_color($arr["class"])."\"><b>" . $arr["username"] . "</b></font></a>" .get_user_icons($arr)."</td>\n".
" <td class=\"tableb\">" . $arr["added"] . "</td>\n".
" <td class=\"tablea\">" . $arr["last_access"] . "</td>\n".
" <td class=\"tableb\" align=\"left\">" . (($arr["title"] != "") ? htmlspecialchars($arr["title"]) : get_user_class_name($arr["class"])) . "</td>\n" . $country .
"</tr>\n";
}
end_table();
begin_table(TRUE);
echo "<tr>\n".
" <td class=\"tablea\" align=\"center\">" . $browsemenu . "<br>" . $pagemenu . "</td>\n".
"</tr>";
end_table();
end_frame();
stdfoot();
?>