Спасибо Soniks блок заработал,правда оптимизировать хотелось бы его еще оптимизировать 4 запроса кушает, внизу код:
Код:
if (eregi("block-User_Info.php",$_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}
$content = "";
global $user, $cookie, $prefix, $user_prefix, $db, $anonymous, $sitekey;
mt_srand ((double)microtime()*1000000);
$maxran = 1000000;
$random_num = mt_rand(0, $maxran);
$datekey = date("F j");
$rcode = hexdec(md5($_SERVER[HTTP_USER_AGENT] . $sitekey . $random_num . $datekey));
$code = substr($rcode, 2, 10);
cookiedecode($user);
$uname = $cookie[1];
$lasturow = $db->sql_fetchrow($db->sql_query("SELECT user_id, username FROM $user_prefix"._users." ORDER BY user_id DESC LIMIT 0,1"));
$lastuser = filter($lasturow['username'], nohtml);
$user_id = ($lasturow['user_id']);
$numrows = $db->sql_numrows($db->sql_query("SELECT user_id FROM $user_prefix"._users.""));
$result = $db->sql_query("SELECT s.uname, u.user_id FROM $prefix"._session." AS s LEFT JOIN $prefix"._users." AS u ON(u.username=s.uname) WHERE s.guest='0'");
$member_online_num = $db->sql_numrows($result);
$who_online_now = "";
$i = 1;
while ($session = $db->sql_fetchrow($result)) {
if ($i < 10) {
$who_online_now .= "$i.<A HREF=\"". IPB_DIR . "/index.php?showuser=$session[user_id]\">$session[uname]</a><br>\n";
} else {
$who_online_now .= "<A HREF=\"". IPB_DIR . "/index.php?showuser=$session[user_id]\">$session[uname]</a><br>\n";
}
$i++;
}
$Today = getdate();
//Formatting Current Date
$month = $Today['month'];
$mday = $Today['mday'];
$year = $Today['year'];
//Formatting Previous Date
$pmonth = $Today['month'];
$pmday = $Today['mday'];
$pmday = $mday-1;
$pyear = $Today['year'];
//Month conversion into numeric mode
if ($pmonth=="January") { $pmonth=1; } else
if ($pmonth=="February") { $pmonth=2; } else
if ($pmonth=="March") { $pmonth=3; } else
if ($pmonth=="April") { $pmonth=4; } else
if ($pmonth=="May") { $pmonth=5; } else
if ($pmonth=="June") { $pmonth=6; } else
if ($pmonth=="July") { $pmonth=7; } else
if ($pmonth=="August") { $pmonth=8; } else
if ($pmonth=="September") { $pmonth=9; } else
if ($pmonth=="October") { $pmonth=10; } else
if ($pmonth=="November") { $pmonth=11; } else
if ($pmonth=="December") { $pmonth=12; };
$test = mktime (0,0,0,$pmonth,$pmday,$pyear,1);
//Creating SQL parameter
$curDate2 = "%".$month[0].$month[1].$month[2]."%".$mday."%".$year."%";
$preday = strftime ("%d",$test);
$premonth = strftime ("%B",$test);
$preyear = strftime ("%Y",$test);
$curDateP = "%".$premonth[0].$premonth[1].$premonth[2]."%".$preday."%".$preyear."%";
$guest_online_num = $db->sql_numrows($db->sql_query("SELECT uname FROM ".$prefix."_session WHERE guest='1'"));
$member_online_num = $db->sql_numrows($db->sql_query("SELECT uname FROM ".$prefix."_session WHERE guest='0'"));
$who_online_num = $guest_online_num + $member_online_num;
$content .= "<form action=\"modules.php?name=Your_Account\" method=\"post\">";
$content .= "<img src=\"images/blocks/group.gif\" ><b>"._BVISIT.": $who_online_num</b>\n<br>\n";
$content .= "<img src=\"images/blocks/ur-anony.gif\" > "._BVIS.": <b>$guest_online_num</b><br>\n";
$content .= "<img src=\"images/blocks/ur-member.gif\" > "._BMEM.": <b>$member_online_num </b></font><br>\n";
if ($member_online_num > 0) {
$content .= "<font class=user>$who_online_now </font><br>";
}
$content .= "<img src=\"images/blocks/group.gif\"> <b>"._BMEMP.":</b></font><br>\n";
$content .= "<img src=\"images/blocks/link.gif\">"._BLATEST.": <A HREF=\"". IPB_DIR . "/index.php?showuser=$user_id\"><b>$lastuser</b></a><br>\n";
$content .= "<img src=\"images/blocks/link.gif\"> "._BOVER.": <b>$numrows</b></font>\n";
$content .= "</form>";