Code:
if (eregi("block-phpBB2_User_Menu.php", $PHP_SELF)) {
Header("Location: index.php");
die();
}
$content = "";
require_once("mainfile.php");
global $user, $cookie, $prefix, $user_prefix, $dbi, $anonymous, $userinfo, $Default_Theme;
getusrinfo($user);
cookiedecode($user);
$ip = getenv("REMOTE_ADDR");
$username = $cookie[1];
if (!isset($username)) {
$username = "$ip";
$guest = 1;
}
$past = time()-900;
sql_query("DELETE FROM $prefix"._session." WHERE time < $past", $dbi);
$result = sql_query("SELECT time FROM $prefix"._session." WHERE uname='$username'", $dbi);
$ctime = time();
if ($row = sql_fetch_array($result, $dbi)) {
sql_query("UPDATE $prefix"._session." SET uname='$username', time='$ctime', host_addr='$ip', guest='$guest' WHERE uname='$username'", $dbi);
} else {
sql_query("INSERT INTO $prefix"._session." (uname, time, host_addr, guest) VALUES ('$username', '$ctime', '$ip', '$guest')", $dbi);
}
$result = sql_query("SELECT username FROM ".$prefix."_users order by user_id DESC limit 0,1", $dbi);
list($lastuser) = sql_fetch_row($result, $dbi);
$result3 = sql_query("SELECT user_id FROM ".$prefix."_users order by user_id DESC limit 0,1", $dbi);
list($ulast) = sql_fetch_row($result3, $dbi);
$numrows = sql_num_rows(sql_query("select user_id from $user_prefix"._users." where user_id <>1 ", $dbi), $dbi);
$result2 = sql_query("SELECT uname,guest FROM $prefix"._session." where guest=0", $dbi);
$member_online_num = sql_num_rows($result2, $dbi);
$who_online_now = "";
$i = 1;
while ($session = sql_fetch_array($result2, $dbi)) {
if (isset($session["guest"]) and $session["guest"] == 0) {
$result5 = sql_query("SELECT user_id FROM ".$prefix."_users where username='$session[uname]'", $dbi);
list($user_id) = sql_fetch_row($result5, $dbi);
if ($i < 10) {
$who_online_now .= " $i: <A HREF=\"profile-.html$user_id\">$session[uname]</a><br>\n";
} else {
$who_online_now .= "$i: <A HREF=\"profile-.html$user_id\">$session[uname]</a><br>\n";
}
$who_online_now .= ($i != $member_online_num ? " " : "");
$i++;
}
}
// Calculate Who's Online
$result = sql_query("SELECT uname FROM $prefix"._session." where guest=1", $dbi);
$guest_online_num = sql_num_rows($result, $dbi);
$result = sql_query("SELECT uname 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 (is_user($user)) {
// For Members
if ($userinfo[user_avatar]) {
$content .= "<center><img src=\"modules/Forums/images/avatars/$userinfo[user_avatar]\" alt=\"\"><br>\n";
}
$content .= "<b>$username</b><br></center>\n";
$result = sql_query("select user_id from $user_prefix"._users." where username='$username'", $dbi);
list($user_id) = sql_fetch_row($result, $dbi);
$result2 = sql_query("select privmsgs_to_userid from $prefix"._bbprivmsgs." where privmsgs_to_userid='$user_id' and privmsgs_type ='0'", $dbi);
$newpms = sql_num_rows($result2, $dbi);
$result3 = sql_query("select privmsgs_to_userid from $prefix"._bbprivmsgs." where privmsgs_to_userid='$user_id' and privmsgs_type ='1'", $dbi);
$oldpms = sql_num_rows($result3, $dbi);
// Members Menu
$content .= "<img src=images/blocks/phpBB2_User_Menu/icon_menu.gif> <b>"._UMBMENU."</b><BR>\n";
$content .= "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>\n";
$content .= "<TR><FORM METHOD=GET ACTION=\"modules.php\">\n";
$content .= "<TD><img src=images/blocks/phpBB2_User_Menu/icon_select.gif> <SELECT NAME=\"name\" CLASS=\"boxcontent\" onChange=\"top.location.href=this.options[this.selectedIndex].value\">\n";
$content .= "<OPTION VALUE=\"\">"._UMBSELECT."";
$content .= "<OPTION VALUE=\"forums.html?file=profile&mode=editprofile\">"._UMBCHANGEYOURINFO."\n";
$content .= "<OPTION VALUE=\"modules.php?name=Your_Account&op=edithome\">"._UMBCHANGEHOME."\n";
$content .= "<OPTION VALUE=\"modules.php?name=Your_Account&op=editcomm\">"._UMBCHANGECOMM."\n";
$content .= "</SELECT></TD></TR></FORM></TABLE>";
// Exit
$content .= "<img src=images/blocks/phpBB2_User_Menu/icon_logout.gif> <a href=\"account-logout.html\">"._UMBEXIT."</a><br>\n";
// Private Messages
$content .= "<a href=\"messages.html\"><img src=\"images/blocks/phpBB2_User_Menu/icon_pm.gif\" border=\"0\" ALT=\""._UMBPM."\"></a> <b>"._UMBPM.":</b>\n";
$content .= "<a href=\"messages.html\"><b>$newpms</b></a> <img src=images/blocks/phpBB2_User_Menu/icon_new.gif><br>\n";
} else {
// Info for guests (users who didn't log in)
if (!is_user($user)) {
mt_srand ((double)microtime()*1000000);
$maxran = 1000000;
$random_num = mt_rand(0, $maxran);
}
$content .= "<center><img src=\"images/blocks/phpBB2_User_Menu/icon_who.gif\" alt=\"\"><br>\n";
$content .= "<b>$anonymous</b><br></center>\n";
$content .="<form action=\"account.html\" method=\"post\">\n";
$content .="<table border=\"0\"><tr><td>\n";
$content .=""._NICKNAME.":</td></tr>\n";
$content .="<tr><td><input type=\"text\" name=\"username\" size=\"15\" maxlength=\"25\"></td></tr>\n";
$content .="<tr><td>"._PASSWORD.":</td></tr>\n";
$content .="<tr><td><input type=\"password\" name=\"user_password\" size=\"15\" maxlength=\"20\"></td></tr>\n";
if (extension_loaded("gd")) {
//$content .="<tr><td colspan='2'>"._SECURITYCODE.": <img src='modules.php?name=Your_Account&op=gfx&random_num=$random_num' border='1' alt='"._SECURITYCODE."' title='"._SECURITYCODE."'></td></tr>\n";
//$content .="<tr><td colspan='2'>"._TYPESECCODE.": <input type=\"text\" NAME=\"gfx_check\" SIZE=\"15\" MAXLENGTH=\"10\"></td></tr>\n";
$content .="<input type=\"hidden\" name=\"random_num\" value=\"$random_num\">\n";
}
$content .="</table><input type=\"hidden\" name=\"redirect\" value=$redirect>\n";
$content .="<input type=\"hidden\" name=\"mode\" value=$mode>\n";
$content .="<input type=\"hidden\" name=\"f\" value=$f>\n";
$content .="<input type=\"hidden\" name=\"t\" value=$t>\n";
$content .="<input type=\"hidden\" name=\"op\" value=\"login\">\n";
$content .="<input type=\"submit\" value=\""._LOGIN."\"></form><br>\n\n";
$content .= "<img src=images/blocks/phpBB2_User_Menu/icon_dot.gif> <a href=\"forums.html?file=profile&mode=register\">"._UMBREG."</a><BR>\n";
$content .= "<img src=images/blocks/phpBB2_User_Menu/icon_dot.gif> <a href=\"modules.php?name=Your_Account&op=pass_lost\">"._UMBLOST."</a><BR>\n";
}
// Submit
//$content .= "</center><BR><img src=images/blocks/phpBB2_User_Menu/icon_news.gif> <b>"._UMBSUBMIT."</a></b><BR>\n";
//$content .= "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>\n";
//$content .= "<TR><FORM METHOD=GET ACTION=\"modules.php\">\n";
//$content .= "<TD><img src=images/blocks/phpBB2_User_Menu/icon_select.gif> <SELECT NAME=\"name\" CLASS=\"boxcontent\" onChange=\"top.location.href=this.options[this.selectedIndex].value\">\n";
//$content .= "<OPTION VALUE=\"\">"._UMBSELECT."";
//$content .= "<OPTION VALUE=\"messages-post-2.html\">"._UMBNEWS."\n";
//$content .= "<OPTION VALUE=\"modules.php?name=Downloads&d_op=AddDownload\">"._UMBADDD."\n";
//$content .= "<OPTION VALUE=\"links.html?amp;l_op=AddLink\">"._UMBADDL."\n";
//$content .= "</SELECT></TD></TR></FORM></TABLE>";
// Members Stats
$content .= "<BR><a href=\"members.html\"><img src=\"images/blocks/phpBB2_User_Menu/icon_profile.gif\" border=\"0\" ALT=\""._UMBMEMP."\"></a> <b>"._UMBMEMP.":</b><br>\n";
$content .= "<img src=images/blocks/phpBB2_User_Menu/icon_last.gif> "._UMBLATEST.": <br> <A HREF=\"profile-.html$ulast\"><b>$lastuser</b></a> <img src=images/blocks/phpBB2_User_Menu/icon_new.gif><br>\n";
$content .= "<img src=images/blocks/phpBB2_User_Menu/icon_registered.gif> "._UMBOVER.": <b>$numrows</b><br>\n";
// Who's Online
$content .= "<BR><a href=\"members.html\"><img src=\"images/blocks/phpBB2_User_Menu/icon_connect.gif\" border=\"0\" ALT=\""._UMBON."\"></a> <b>"._UMBON."[$who_online_num]:</b><br>\n";
$content .= "<img src=images/blocks/phpBB2_User_Menu/icon_users.gif> "._UMBVIS.": <b>$guest_online_num</b><br>\n";
$content .= "<img src=images/blocks/phpBB2_User_Menu/icon_registered.gif> "._UMBMEM.": <b>$member_online_num</b><br>\n";
if ($member_online_num > 0) {
$content .= "$who_online_now<br>";
}
cookiedecode($user);
$username = $cookie[1];
$result = sql_query("select user_new_privmsg from ".$user_prefix."_users where username='$username'", $dbi);
list($numrow) = sql_fetch_row($result, $dbi);
if ($numrow > 0) {
echo "<script language='javascript'>\n"
."<!--\n"
."var win = window.open('modules.php?name=Private_Messages&popup=1&mode=newpm', '', 'height=225,width=400')"
."//-->\n"
."</script>";
}
// Total Hits
$result = sql_query("SELECT count FROM ".$prefix."_counter WHERE type='total' AND var='hits'", $dbi);
$result = sql_fetch_row($result, $dbi);
$content .= "<BR><center><img src=images/blocks/phpBB2_User_Menu/icon_hit.gif ><br><small>"._WERECEIVED."</small><br><b><a href=\"stats.html\">$result[0]</a></b></small></center>";
?>
|