From b830750d511acb0e170935bbca27cf28a3584423 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Sun, 15 Apr 2001 16:37:53 +0000 Subject: Whosonline implementation git-svn-id: file:///svn/phpbb/trunk@146 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewonline.php | 166 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 phpBB/viewonline.php (limited to 'phpBB/viewonline.php') diff --git a/phpBB/viewonline.php b/phpBB/viewonline.php new file mode 100644 index 0000000000..11dc8a51c3 --- /dev/null +++ b/phpBB/viewonline.php @@ -0,0 +1,166 @@ +sql_query($sql); +if(!$result) +{ + error_die($db, QUERY_ERROR); +} +$onlinerow = $db->sql_fetchrowset($result); +if(!$onlinerow) +{ + error_die($db, QUERY_ERROR, "Couldn't fetchrow"); +} + +$template->assign_vars(array( + "PHP_SELF" => $PHP_SELF, + "POST_FORUM_URL" => POST_FORUM_URL, + "POST_USER_URL" => POST_USER_URL, + "L_WHOSONLINE" => $l_whosonline, + "L_USERNAME" => $l_username, + "L_LOCATION" => $l_location + ) +); + +$online_count = $db->sql_numrows($result); +if($online_count) +{ + for($i = 0; $i < $db->sql_numrows($result); $i++) + { + + if($row_color == "#DDDDDD") + { + $row_color = "#CCCCCC"; + } + else + { + $row_color = "#DDDDDD"; + } + + if(!stristr($onlinerow[$i]['username'], "Anonymous")) + { + $username = $onlinerow[$i]['username']; + if($onlinerow[$i]['session_logged_in']) + { + $username .= "  [ Logged In ]"; + } + else + { + $username .= "  [ Logged Out ]"; + } + } + else + { + $username .= "$l_anonymous"; + } + + if($onlinerow[$i]['forum_name'] == "") + { + switch($onlinerow[$i]['session_page']) + { + case PAGE_INDEX: + $location = "Forum Index"; + break; + case PAGE_LOGIN: + $location = "Logging On"; + break; + case PAGE_SEARCH: + $location = "Topic Search"; + break; + case PAGE_REGISTER: + $location = "Registering"; + break; + case PAGE_VIEWPROFILE: + $location = "Viewing Profiles"; + break; + case PAGE_ALTERPROFILE: + $location = "Altering Profile"; + break; + case PAGE_VIEWONLINE: + $location = "Viewing Who's Online"; + break; + case PAGE_VIEWMEMBERS: + $location = "Viewing Memberlist"; + break; + case PAGE_FAQ: + $location = "Viewing FAQ"; + break; + default: + $location = "Forum Index"; + } + $location_url = "index.".$phpEx; + } + else + { + $location_url = "viewforum.".$phpEx."?".POST_FORUM_URL."=".$onlinerow[$i]['forum_id']; + $location = $onlinerow[$i]['forum_name']; + } + + $template->assign_block_vars("userrow", + array("ROW_COLOR" => $row_color, + "USER_ID" => $onlinerow[$i]['user_id'], + "USERNAME" => $username, + "LOCATION" => $location, + "LOCATION_URL" => $location_url + ) + ); + + } + + $template->pparse("body"); +} +else +{ + error_die($db, GENERAL_ERROR, "There are no users currently browsing this forum"); +} + +include('includes/page_tail.'.$phpEx); + +?> -- cgit v1.2.1