<?php
/************************************************************************/
/* ViperWeb: Web Portal System */
/* =========================== */
/* */
/* Copyright (c) 2002 by Raptr & Godboko */
/* http://development.ea-hq.net */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/* */
/* Based on PHP-Nuke found at http://www.phpnuke.org */
/************************************************************************/
if (eregi("block-Who_is_Online.php", $PHP_SELF)) {
Header("Location: index.php");
die();
}
global $user, $cookie, $prefix, $dbi, $user_prefix;
cookiedecode($user);
$ip = getenv("REMOTE_ADDR");
$username = $cookie[1];
if (!isset($username)) {
$username = "$ip";
$guest = 1;
}
$result = sql_query("SELECT username FROM ".$prefix."_session where guest=1", $dbi);
$guest_online_num = sql_num_rows($result, $dbi);
$result = sql_query("SELECT username FROM ".$prefix."_session where guest=0", $dbi);
$member_online_num = sql_num_rows($result, $dbi);
$who_online_num = $guest_online_num + $member_online_num;
if ($guest_online_num =="") { $guest_online_num = "0"; }
if ($member_online_num =="") { $member_online_num = "0"; }
$who_online = "<center><font class=\"content\">"._CURRENTLY." $guest_online_num "._GUESTS." $member_online_num "._MEMBERS."<br>";
$result = sql_query("select title from ".$prefix."_blocks where bkey='online'", $dbi);
list($title) = sql_fetch_row($result, $dbi);
$content = "$who_online";
if (is_user($user)) {
$content .= "<br>"._YOUARELOGGED." <b>$username</b>.<br>";
if (is_active("Private_Messages")) {
$result = sql_query("select user_new_privmsg from ".$user_prefix."_users where uname='$username'", $dbi);
list($numrow) = sql_fetch_row($result, $dbi);
if ($newnumrow == "0") {
$content .= ""._YOUHAVE." no "._PRIVATEMSG."";
} else {
$content .= ""._YOUHAVE." <a href=\"index.php?mod=Private_Messages\"><b>$numrow</b></a> "._PRIVATEMSG."";
}
}
$content .= "</font></center>";
} else {
$content .= "<br>"._YOUAREANON."</font></center>";
}
?>