gang members
Wave that flag!
<p>
<?php
$sort = $_GET'sort'];
if (empty($sort)) $sort = "posts";
if ("posts" == $sort) $sort = "posts desc";
$results = db_query("SELECT uid, name, mail, created FROM users WHERE uid > 0 and status <> 0");
$stack = array();
while ($row = db_fetch_array($results)) {
$nodes = db_query("SELECT COUNT(nid) FROM node WHERE uid = ".$row'uid']);
$nnum = db_result($nodes);
$comments = db_query("SELECT COUNT(cid) FROM comments WHERE uid = ".$row'uid']);
$cnum = db_result($comments);
$email = preg_replace('/(@)/', '[at]', $row'mail']);
$email = preg_replace('/(\.)/', '[dot]', $email);
if ("name" == $sort) {
$index = $row'name'];
} else if ("created" == $sort) {
$index = $row'created'] . $row'name'];
} else {
$t = ($nnum + $cnum);
$u = $row'name'];
if ($t < 10) {
$index = '000000000' . $t . $u;
} else if ($t < 100) {
$index = '00000000' . $t . $u;
} else if ($t < 1000) {
$index = '0000000' . $t . $u;
} else if ($t < 10000) {
$index = '000000' . $t . $u;
} else if ($t < 100000) {
$index = '00000' . $t . $u;
} else if ($t < 1000000) {
$index = '0000' . $t . $u;
} else if ($t < 10000000) {
$index = '000' . $t . $u;
} else if ($t < 100000000) {
$index = '00' . $t . $u;
} else if ($t < 1000000000) {
$index = '0' . $t . $u;
} else {
$index = $t . $u;
}
}
$stack$index] = array($email, $row'name'], $row'created'], ($nnum + $cnum));
}
print "<table border=1 width=400>";
print " <tr align=center>";
print " <td><a href=\"?q=node/901&sort=name\">name</a></td>";
print " <td><a href=\"?q=node/901&sort=created\">joined</a></td>";
print " <td><a href=\"?q=node/901&sort=posts\">posts</a></td>";
print " </tr>";
if ("name" == $sort) {
ksort($stack);
} else if ("created" == $sort) {
ksort($stack);
} else {
krsort($stack);
}
while (list($i, $s) = each($stack)) {
print "<tr>";
print "<td>";
print "<a href=\"mailto:".$s[0]."\">".$s[1]."</a>";
print "</td>";
print "<td>".strftime('%Y.%m.%d', $s[2])."</td>";
print "<td>" . $s[3] . "</td>";
print "</tr>";
}
print "</table>";
?>