0 ORDER BY user_id DESC LIMIT 1";
list($lastuser) = $db->sql_fetchrow($db->sql_query($sql));
return $lastuser;
}
//Total Members
function numusers() {
global $prefix, $db;
$sql = "SELECT COUNT(*) FROM ".$prefix."_users WHERE user_id > 1";
list($numrows) = $db->sql_fetchrow($db->sql_query($sql));
$numrows = number_format($numrows);
return $numrows;
}
//Total Waiting
function waiting_users() {
global $prefix, $db;
$sql = "SELECT COUNT(*) FROM ".$prefix."_users_temp";
list($numrowswaiting) = $db->sql_fetchrow($db->sql_query($sql));
return $numrowswaiting;
}
//New Users Today and Yesterday
function new_users() {
global $prefix, $db;
$sql = "SELECT COUNT(*) FROM ".$prefix."_users WHERE user_regdate='".date("M d, Y")."'";
list($userCount[0]) = $db->sql_fetchrow($db->sql_query($sql));
$sql = "SELECT COUNT(*) FROM ".$prefix."_users WHERE user_regdate='".date("M d, Y", time()-86400)."'";
list($userCount[1]) = $db->sql_fetchrow($db->sql_query($sql));
return $userCount;
}
if ($dopmpopup == 1) {
if ($userinfo['user_popup_pm'] && $userinfo['user_new_privmsg']) {
$content .= "";
}
}
//Registered users online
$members = $db->sql_query("SELECT w.uname, w.module, w.url, u.user_id, u.user_level, u.user_allow_viewonline FROM ".$prefix."_session AS w LEFT JOIN ".$prefix."_users AS u ON u.username = w.uname WHERE guest = '0' ORDER by u.user_id ASC");
$guests = $db->sql_query("SELECT uname FROM ".$prefix."_session WHERE guest ='1'");
//Online Total data
$online_num[0] = $db->sql_numrows($members);
$online_num[1] = $db->sql_numrows($guests);
$online_num[2] = $online_num[0] + $online_num[1];
//Assemble the online registered users
$who_online_now = "";
$i = 1;
while ($session = $db->sql_fetchrow($members)) {
//Allow View?
if ($session['user_allow_viewonline'] || is_admin($admin)) {
if ($i < 10) $czi = "0$i"; else $czi = $i;
//$uid = intval($session['user_id']);
$uname = $session['uname'];
$ulevel = intval($session['user_level']);
$mod = $session['module'];
$url = $session['url'];
if ($Version_Num < 7.6) {
if(preg_match("/admin/", $url)) {
$mod = "Private";
$url = "index.php";
}
} elseif ($Version_Num >= 7.6) {
if(preg_match("/".$admin_file."/", $url)) {
$mod = "Private";
$url = "index.php";
}
}
if ((is_admin($admin)) && ($showonlyadmin == 0)) {
$where = "$czi. ";
} elseif ($showonlyadmin == 1) {
$where = "$czi. ";
} else {
$where = "$czi. ";
}
if ($ulevel == 2) {
$who_online_now .= "
$where$uname \n";
}
elseif ($ulevel == 3) {
$who_online_now .= "
$where$uname \n";
}
else {
$who_online_now .= "
$where$uname\n";
}
$who_online_now .= ( $i != $online_num[0] ? "" : "" );
$i++;
} else {
$hidden++;
}
} //Allow View
$db->sql_freeresult($members);
//Mostonline data
$result = $db->sql_query("SELECT total, members, nonmembers FROM ".$prefix."_mostonline");
$row = $db->sql_fetchrow($result);
$total = intval($row['total']);
$members = intval($row['members']);
$nonmembers = intval($row['nonmembers']);
$db->sql_freeresult($result);
//Break Mostonline Total?
if ($total < $online_num[2]) {
$db->sql_query("DELETE FROM ".$prefix."_mostonline WHERE total='$total' LIMIT 1");
$db->sql_query("INSERT INTO ".$prefix."_mostonline VALUES ('$online_num[2]','$online_num[0]','$online_num[1]')");
}
if (is_user($user)) {
//Greet User
$urname = $userinfo['username'];
$content .= "
\n";
$content .= "\n";
if ($useavatars == 1) {
//Avatars...
$bbconf = array();
$result = $db->sql_query("SELECT * FROM ".$prefix."_bbconfig");
while(list($config_name, $config_value) = $db->sql_fetchrow($result)){
$bbconf[$config_name] = $config_value;
}
if ($userinfo['user_allowavatar']) {
if ($userinfo['user_avatar_type'] == 1) {
$content .= "