1 Star 3 Fork 2

mojie126/HDCN-PT

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
users.php 4.04 KB
一键复制 编辑 原始数据 按行查看 历史
mojie126 提交于 2014-12-17 18:32 . 拆分function
<?php
require "include/bittorrent.php";
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
parked();
if (get_user_class() < $viewuserlist_class)
permissiondenied();
$search = trim($_GET['search']);
$class = $_GET['class'];
$country = 0+$_GET['country'];
$letter = trim($_GET["letter"]);
if (strlen($letter) > 1)
die;
if(!is_valid_user_class($class))
$class = '-';
if (($search != '' || $class != '-') && $letter == '')
{
$query = "username LIKE " . sqlesc("%$search%") ;
if ($search)
$q = "search=" . rawurlencode($search);
}
elseif ($letter != '' && strpos("0abcdefghijklmnopqrstuvwxyz", $letter) == true)
{
$query = "username LIKE '$letter%' ";
$q = "letter=$letter";
}
else
{
$query = "status='confirmed'";
}
if ($class != '-')
{
$query .= " AND class=$class";
$q .= ($q ? "&" : "") . "class=$class";
}
if ($country > 0)
{
$query .= " AND country=$country";
$q .= ($q ? "&" : "") . "country=$country";
}
stdhead($lang_users['head_users']);
print($lang_users['text_users']);
print("<form method=get action=?>\n");
print($lang_users['text_search'] ." <input type=text style=\"width:100px\" name=search value=$search> \n");
print("<select name=class>\n");
print("<option value='-'>".$lang_users['select_any_class']."</option>\n");
for ($i = 0;;++$i)
{
if ($c = get_user_class_name_zh($i,false,true,true))
print("<option value=$i" . ($class != '-' && $class == $i ? " selected" : "") . ">$c</option>\n");
else
break;
}
print("</select>\n");
$countries = "<option value=0>".$lang_users['select_any_country']."</option>\n";
$ct_r = sql_query("SELECT id,name FROM countries ORDER BY name") or die;
while ($ct_a = mysql_fetch_array($ct_r))
$countries .= "<option value=".htmlspecialchars($ct_a[id]).">".htmlspecialchars($ct_a[name])."</option>\n";
print("<select name=country>".$countries."</select>");
print("<input type=submit value=\"".$lang_users['submit_okay']."\">\n");
print("</form>\n");
print("<p>\n");
for ($i = 97; $i < 123; ++$i)
{
$l = chr($i);
$L = chr($i - 32);
//stderr("",$class);
if ($l == $letter)
print("<font class=gray><b>$L</b></font>\n");
else
{
if($class == '-')
print("<a href=?letter=$l".($country > 0 ? "&country=".$country : "")."><b>$L</b></a>\n");
else
{
print("<a href=?letter=$l&class=$class".($country > 0 ? "&country=".$country : "")."><b>$L</b></a>\n");
}
}
}
print("</p>\n");
$perpage = 50;
$res = sql_query("SELECT COUNT(*) FROM users WHERE $query") or sqlerr();
$arr = mysql_fetch_row($res);
$count = $arr[0];
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, "users.php?".$q.($q ? "&" : ""));
print($pagertop);
$country_sql = "concat('<img src=\"pic/flag/', countries.flagpic, '\" alt=\"', countries.name ,'\">')";
$sql = sprintf('SELECT
users.id as id,
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
LEFT JOIN countries ON users.country = countries.id
WHERE %s
ORDER BY username %s',
$country_sql, $query, $limit);
$res = sql_query($sql) or sqlerr();
$num = mysql_num_rows($res);
print("<table border=1 cellspacing=0 cellpadding=5>\n");
print("<tr><td class=colhead align=left>".$lang_users['col_user_name']."</td><td class=colhead>".$lang_users['col_registered']."</td><td class=colhead>".$lang_users['col_last_access']."</td><td class=colhead align=left>".$lang_users['col_class']."</td><td class=colhead>".$lang_users['col_country']."</td></tr>\n");
for ($i = 0; $i < $num; ++$i)
{
$arr = mysql_fetch_assoc($res);
print("<tr><td align=left>".get_username($arr['id'])."</td><td>".gettime($arr['added'], true, false)."</td><td>".gettime($arr['last_access'],true,false)."</td><td align=left>". get_user_class_name_zh($arr['class'],false,true,true) . "</td><td align=center>".$arr['country']."</td></tr>");
}
print("</table>");
print($pagerbottom);
stdfoot();
die;
?>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/mojie126/HDCN-PT.git
git@gitee.com:mojie126/HDCN-PT.git
mojie126
HDCN-PT
HDCN-PT
master

搜索帮助