diff --git a/lib/function.php b/lib/function.php index b414fc4..df588ab 100644 --- a/lib/function.php +++ b/lib/function.php @@ -329,7 +329,7 @@ function timeunits($sec){ if($sec<86400) return floor($sec/3600).' hours'; if($sec<172800) return '1 day'; if($sec<31556926) return floor($sec/86400).' days'; - return sprintf("%.1f years", floor($sec/31556926)); + return sprintf("%.1f years", $sec/31556926); } function timeunits2($sec){ diff --git a/memberlist.php b/memberlist.php index 2da5c97..7f9d32b 100644 --- a/memberlist.php +++ b/memberlist.php @@ -42,12 +42,13 @@ $where = 'WHERE '.((empty($qwhere)) ? '1' : implode(' AND ', $qwhere)); - if (!in_array($sort, array('name','reg','exp','age','posts'))) + if (!in_array($sort, array('name','reg','exp','age','posts', 'act'))) $sort = 'posts'; - $query='SELECT id,posts,regdate,name,minipic,sex,powerlevel,aka,r.* FROM users LEFT JOIN users_rpg r ON id=uid '; + $query='SELECT id,posts,regdate,lastactivity,name,minipic,sex,powerlevel,aka,r.* FROM users LEFT JOIN users_rpg r ON id=uid '; if($sort=='name') $users1=$sql->query("$query$where ORDER BY name", MYSQL_ASSOC); if($sort=='reg') $users1=$sql->query("$query$where ORDER BY regdate DESC", MYSQL_ASSOC); + if($sort=='act') $users1=$sql->query("$query$where ORDER BY lastactivity DESC", MYSQL_ASSOC); if($sort=='exp') $users1=$sql->query("$query$where", MYSQL_ASSOC); if($sort=='age') $users1=$sql->query("$query$where AND birthday ORDER BY birthday", MYSQL_ASSOC); if($sort=='posts') $users1=$sql->query("$query$where ORDER BY posts DESC", MYSQL_ASSOC); @@ -80,6 +81,7 @@ $lnk=exp$q$qpow$qsex>EXP | $lnk=name$q$qpow$qsex>User name | $lnk=reg$q$qpow$qsex>Registration date | + $lnk=act$q$qpow$qsex>Last activity | $lnk=age$q$qpow$qsex>Age $tccell1s> Sex: @@ -93,7 +95,7 @@ $tccell2s> $lnk=$sort$q$qsex&pow=-1>Banned | $lnk=$sort$q$qsex&pow=0>Normal | - ". ($loguser['powerlevel'] >= 3 ? "$lnk=$sort$q$qsex&pow=1>Normal + | " : "") ." + ". ($loguser['powerlevel'] >= 1 ? "$lnk=$sort$q$qsex&pow=1>Normal + | " : "") ." $lnk=$sort$q$qsex&pow=2>Moderator | $lnk=$sort$q$qsex&pow=3>Administrator | $lnk=$sort$q$qsex>All @@ -107,6 +109,7 @@ if(!$rpg) { print " $tccellh width=200>Registered on + $tccellh width=200>Last active $tccellh width=60>Posts $tccellh width=35>Level $tccellh width=100>EXP @@ -137,17 +140,18 @@ $userlink = getuserlink($user); $ulist.=" - $tccell2>".($i+1).". + $tccell2>".($i+1)." $tccell1l>{$userpicture} $tccell2l>{$userlink} "; if(!$rpg){ $ulist.=" - $tccell2>".date($dateformat,$user['regdate']+$tzoff)." - $tccell1>{$user['posts']} - $tccell1>{$user['lvl']} - $tccell1>{$user['exp']} + $tccell2>".date($dateformat,$user['regdate']+$tzoff)." + $tccell2>".date($dateformat,$user['lastactivity']+$tzoff)." + $tccell1r>{$user['posts']} + $tccell1r>{$user['lvl']} + $tccell1r>{$user['exp']} "; } else { @@ -165,4 +169,4 @@ } print "$ulist$tblend$pagelinks$footer"; - printtimedif($startingtime); \ No newline at end of file + printtimedif($startingtime);