<?ph
function
get_site_user_order_by_gold(
$num
=20){
$userlist
= db_find(
'user'
,
array
(),
array
(
'golds'
=>2), 1,
$num
,
'uid'
);
foreach
(
$userlist
as
$user
) {
echo
'用户名:'
.
$user
[
'username'
].
'积分:'
.
$user
[
'credits'
].
'金币:'
.
$user
[
'golds'
].
'<br/>'
;
}
}
function
get_site_new_user(
$num
=16){
$userlist
= cache_get(
'get_site_new_user'
);
if
(
empty
(
$userlist
)){
$userlist
= db_find(
'user'
,
array
(),
array
(
'uid'
=>-1), 1,
$num
,
'uid'
);
foreach
(
$userlist
as
&
$user
) {
$username
=
$user
[
'username'
];
xn_strlen(
$username
)>4 &&
$username
= xn_substr(
$username
, 0, 4);
$user
[
'dname'
] =
$username
;
}
cache_set(
'get_site_new_user'
,
$userlist
,86400);
}
return
$userlist
;
}
?>
<?php
$nIndex
= 0;
$userlist
= get_site_new_user();
foreach
(
$userlist
as
$user
) {
if
(++
$nIndex
>16)
break
;
$user_avatarimg
=
'view/img/avatar.png'
;
$user
[
'avatar'
]!=0 &&
$user_avatarimg
=
$conf
[
'upload_url'
].
'avatar/000/'
.
$user
[
'uid'
].
'.png?'
.
$user
[
'avatar'
];
if
(
$cdn_enable
)
$user_avatarimg
=
$theme_plugin
[
'cdn_url'
].
$user_avatarimg
;
?>
<div
class
=
"col-xs-4 text-center mb-3"
>
<a
class
=
"tt"
href=
"<?php echo url("
user-
$user
[uid]
");?>"
data-toggle=
"tooltip"
title=
"<?php echo $user['dname'];?>"
>
<img src=
"<?php echo $user_avatarimg; ?>"
alt=
"<?php echo $user['dname'];?>"
width=
"39"
height=
"39"
class
=
"img-circle"
><br>
<?php
echo
$user
[
'dname'
];?>
</a>
</div>
<?php } ?