Я все еще на 1.9, блок use-rinfo, с помощью бубна и шаманских плясок замутил из нескольких блоков. Вот что получилось. Мне нравится.
Небольшое изменение в function.php дописать , $u_a;
function online() {
global сюда
13.12.jpg ( 36.6 Кб )
Кол-во загрузок: 6КОД
<?php
if (!defined('BLOCK_FILE')) {
Header("Location: ../index.php");
exit;
}
global $user, $cookie, $prefix, $user_prefix, $db, $anonymous, $sitekey, $userinfo, $admin, $gfx_chk, $language, $points;
include("language/lang-$language.php");
include("config/config_bots.php");
getusrinfo($user);
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);
getusrinfo($user);
$uname = $userinfo['username'];
//cookiedecode($user);
//$uname = $cookie[1];
$points = $userinfo['points'];
$ip = "Ваш IP: ".$_SERVER['REMOTE_ADDR']."";
$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; $prus="января"; } else
if ($pmonth=="February") { $pmonth=2; $prus="февраля";} else
if ($pmonth=="March") { $pmonth=3; $prus="марта"; } else
if ($pmonth=="April") { $pmonth=4; $prus="апреля";} else
if ($pmonth=="May") { $pmonth=5; $prus="мая";} else
if ($pmonth=="June") { $pmonth=6; $prus="июня";} else
if ($pmonth=="July") { $pmonth=7; $prus="июля";} else
if ($pmonth=="August") { $pmonth=8; $prus="августа";} else
if ($pmonth=="September") { $pmonth=9; $prus="сентября"; } else
if ($pmonth=="October") { $pmonth=10; $prus="октября";} else
if ($pmonth=="November") { $pmonth=11; $prus="ноября";} else
if ($pmonth=="December") { $pmonth=12; $prus="декабря";};
$test = mktime (0,0,0,$pmonth,$pmday,$pyear,-1);
//Creating SQL parameter
$CurDate = "%".$month[0].$month[1].$month[2]."%".$mday."%".$year."%";
$preday = strftime ("%d",$test);
$premonth = strftime ("%B",$test);
$preyear = strftime ("%Y",$test);
$PastDate = "%".$premonth[0].$premonth[1].$premonth[2]."%".$preday."%".$preyear."%";
$ThisMounth = "%".$month[0].$month[1].$month[2]."%";
// Считает сколько зарегистрировано сегодня
list($userCount) = $db->sql_fetchrow($db->sql_query("SELECT COUNT(user_id) AS userCount FROM $user_prefix"._users." WHERE user_regdate LIKE '$CurDate'", $db));
// Считает сколько зарегистрировано вчера (чтобы не работало закомментируйте нижестоящую (85) и 190 строки)
list($userCount2) = $db->sql_fetchrow($db->sql_query("SELECT COUNT(user_id) AS userCount2 FROM $user_prefix"._users." WHERE user_regdate LIKE '$PastDate'", $db));
// Считает сколько зарегистрировано в этом месяце
list($userCount3) = $db->sql_fetchrow($db->sql_query("SELECT COUNT(user_id) AS userCount2 FROM $user_prefix"._users." WHERE user_regdate LIKE '$ThisMounth'", $db));
list($lastuser, $newid) = $db->sql_fetchrow($db->sql_query("SELECT username, user_id FROM $user_prefix"._users." ORDER BY user_id DESC LIMIT 0,1", $db));
if(strlen($lastuser)>18){$lastuser = substr("$lastuser", 0,18); $lastuser.= "...";}
$allusers = $db->sql_numrows($db->sql_query("SELECT user_id FROM $user_prefix"._users." WHERE user_id!= 1", $db));
$content .= <<<JS
<div align="center"><b>Добр<script language="JavaScript">
date = new Date()
date = date.getHours()
if (date >= 0 && date < 6) {document.write("ой ночи")}
else {if (date >= 6 && date < 12) {document.write("ое утро")}
else {if (date >= 12 && date < 18) {document.write("ый день")}
else {document.write("ый вечер")}
}
}
</script><br>$uname</b></div>
JS;
if (is_user($user)) {
getusrinfo($user);
$uname = $userinfo['username'];
$user_id = $userinfo['user_id'];
$user_avatar = $userinfo['user_avatar'];
if ($userinfo[user_avatar]) {
$content .= "<br><center><a href=\"index.php?name=Account&op=avatarlist\"><img src=\"/images/avatars/$userinfo[user_avatar]\" border=\"0\"></a><br>";
} else {
$content .= "<br><center><img src=\"images/avatars/00.gif\"><br>";
}
$content .= "".$mday." ".$prus." ".$year." г.";
$content .= <<<JS
<br>Сайту <script language=JavaScript>
d0 = new Date('June 01, 2006');
d1 = new Date();
dt = (d1.getTime() - d0.getTime()) / (1000*60*60*24);
document.write(Math.round(dt) + "-й день");
</SCRIPT><BR>
JS;
if ($points >= 1000) {
$content .= "У вас <font color=red><b>".$points."</b></font> баллов<br>";
} else {
$content .= "У вас <b>".$points."</b> баллов<br>";
}
$content .= "" . "$ip" . "</center>";
$content .= "<hr><img src=\"images/blocks/useronline/icon_logout.gif\" align=\"absmiddle\"><a href=\"index.php?name=Account&op=logout\"> <b>"._UMBEXIT."</b></a><hr>";
$user_id = intval($user_id);
$row3 = $db->sql_fetchrow($db->sql_query("SELECT user_id FROM $user_prefix"._users." WHERE username='$uname'"));
$uid = intval($row3[user_id]);
$newpms = $db->sql_numrows($db->sql_query("SELECT privmsgs_to_userid FROM $prefix"._bbprivmsgs." WHERE privmsgs_to_userid='$uid' AND (privmsgs_type='1' OR privmsgs_type='5')", $db));
$oldpms = $db->sql_numrows($db->sql_query("SELECT privmsgs_from_userid FROM $prefix"._bbprivmsgs." WHERE privmsgs_from_userid='$uid' AND (privmsgs_type='1' OR privmsgs_type='5')", $db));
$content .= "<img src=\"images/blocks/useronline/email-y.gif\" height=\"10\" width=\"14\"> <a href=\"index.php?name=Private_Messages\"><b>"._BPM."</b></a><br>\n";
$content .= "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\">\n";
$content .= "<tr><td><img src=\"images/blocks/useronline/icon2.gif\" height=\"10\" width=\"10\" align=\"absmiddle\">"._UMNMSG.":</td><td align=\"right\"> <b>$newpms</b></td></tr>\n";
$content .= "<tr><td><img src=\"images/blocks/useronline/icon2.gif\" height=\"10\" width=\"10\" align=\"absmiddle\">"._UMOMSG.":</td><td align=\"right\"> <b>$oldpms</b></td></tr>\n";
$content .= "</tr></table><hr>\n";
$content .= "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\">";
$content .= "<tr><td colspan=2><img src=\"images/blocks/useronline/icon_profile.gif\" height=\"15\" width=\"19\"><b><center>"._BMEMP.":</center></b></td></tr>";
$content .= "<tr><td colspan=2><img src=\"images/blocks/useronline/ur-moderator.gif\" height=\"15\" width=\"15\"> "._BLATEST.": <A HREF=\"index.php?name=Forums&file=profile&mode=viewprofile&u=$newid\"><b>$lastuser</b></a></td></tr>";
$content .= "<tr><td width=85%><img src=\"images/blocks/useronline/ur-author.gif\" height=\"15\" width=\"15\"> "._BTD.":</td><td align=\"right\"> <b>$userCount</b></td></tr>";
$content .= "<tr><td width=85%><img src=\"images/blocks/useronline/ur-admin.gif\" height=\"15\" width=\"15\"> "._BYD.":</td><td align=\"right\"> <b>$userCount2</b></td></tr>";
$content .= "<tr><td width=85%><img src=\"images/blocks/useronline/ur-admin.gif\" height=\"15\" width=\"15\"> "._BMD.":</td><td align=\"right\"> <b>$userCount3</b></td></tr>";
$content .= "<tr><td width=85%><img src=\"images/blocks/useronline/ur-guest.gif\" height=\"15\" width=\"15\"> "._BOVER.":</td><td align=\"right\"> <b>$allusers</b></td></tr></table>";
} else {
$content .= "<form action=\"index.php?name=Account\" method=\"post\">";
$content .= "<br><center><img src=\"images/avatars/00.gif\"></center><br>\n";
$content .= "<table border=\"0\"><tr valign=\"middle\"><td><a href=\"index.php?name=Account\"><img src=\"images/blocks/new_user.gif\" border=\"0\"></a></td><td><a href=\"index.php?name=Account\">"._BREG."</a></td></tr></table>\n";
$content .= "<table border=\"0\"><tr valign=\"middle\"><td><a href=\"index.php?name=Account&op=pass_lost\"><img src=\"images/blocks/pass_lost.gif\" border=\"0\"></td><td><a href=\"index.php?name=Account&op=pass_lost\">"._PASSFOR."</a></td></tr></table><hr>\n";
$content .= "<table align=\"center\" width=\"100%\"><tr><td>"._NICKNAME.":</td><td><input type=\"text\" name=\"username\" size=\"10\" maxlength=\"25\"></td></tr>";
$content .= "<tr><td>"._PASSWORD.":</td><td><input type=\"password\" name=\"user_password\" size=\"10\" maxlength=\"20\"></td></tr>";
if (extension_loaded("gd") AND ($gfx_chk == 2 OR $gfx_chk == 4 OR $gfx_chk == 5 OR $gfx_chk == 7)) {
mt_srand ((double)microtime()*1000000);
$maxran = 1000000;
$random_num = mt_rand(0, $maxran);
$content .= "<tr><td>"._SECURITYCODE.":</td><td><img src='?gfx=gfx&random_num=$random_num' border='1' alt='"._SECURITYCODE."' title='"._SECURITYCODE."'></td></tr>";
$content .= "<tr><td>"._TYPESECCODE.":</td><td><input type=\"text\" name=\"gfx_check\" size=\"10\" maxlength=\"6\"></td></tr>";
$content .= "<input type=\"hidden\" name=\"random_num\" value=\"$random_num\">\n";
} else {
$content .= "<input type=\"hidden\" name=\"random_num\" value=\"$random_num\">\n";
$content .= "<input type=\"hidden\" name=\"gfx_check\" value=\"$code\">\n";
}
$content .= "<tr><td colspan=\"2\" align=\"center\"><input type=\"hidden\" name=\"op\" value=\"login\">\n";
$content .= "<input type=\"submit\" value=\""._LOGIN."\"></center></td></tr></form></table><hr>\n";
}
$strip = 10;
$result = $db->sql_query("SELECT uname, guest, module, u_a, UNIX_TIMESTAMP(now())-time AS time FROM ".$prefix."_session ORDER BY uname");
while (list($uname, $guest, $module, $u_a, $time) = $db->sql_fetchrow($result)) {
//$linkstrip = cutstr($module, $strip);
$linkstrip = ereg_replace("_", " ", cutstr($module, $strip));
switch ($linkstrip) {
case "News":
$linkstrip = "Новости";
break;
case "Private Me...":
$linkstrip = "Личка";
break;
case "Forums":
$linkstrip = "Форумы";
break;
case "Topics":
$linkstrip = "Темы";
break;
case "FAQ":
$linkstrip = "ЧАВО";
break;
case "Pages":
$linkstrip = "Статьи";
break;
case "Article":
$linkstrip = "Главы";
break;
case "Jokes":
$linkstrip = "Анекдоты";
break;
case "GuestBook":
$linkstrip = "Гостевая";
break;
case "Contact":
$linkstrip = "Контакт";
break;
case "Statistics":
$linkstrip = "Статистика";
break;
case "News Archi...":
$linkstrip = "Архив новостей";
break;
case "Kalendar":
$linkstrip = "Календарь";
break;
case "Members Li...":
$linkstrip = "Пользователи";
break;
case "Voting":
$linkstrip = "Опросы";
break;
case "Search":
$linkstrip = "Поиск";
break;
case "Recommend":
$linkstrip = "Рекомендовать";
break;
case "Encycloped...":
$linkstrip = "Энциклопедия";
break;
case "Account":
$linkstrip = "Аккаунт";
break;
default:
$linkstrip = $linkstrip;
break;
}
if ($guest == 0) {
$title_who = "<tr><td><a href=\"index.php?name=Account&op=userinfo&username=$uname\" title=\"".displayTime($time)."\">$uname</a></td><td align=\"right\">$linkstrip</td></tr>";
$m++;
} else {
$title_who = "";
$u++;
if ($bots_check == 1) {
$bots = file_get_contents("config/bots.dat");
$bots_array = explode("\n", $bots);
for ($k=0; $k< count($bots_array); $k++) {
$bots_data = explode("=", $bots_array[$k]);
if (eregi($bots_data[0], $u_a)) {
$title_who = "<tr><td><div title=\"".displayTime($time)."\">".cutstr($bots_data[1], 15)."</div></td><td align=\"right\">$linkstrip</td></tr>";
$b++;
$u--;
}
}
}
}
$who_online[$guest] .= $title_who;
$i++;
}
if ($m == "") $m = 0;
if ($u == "") $u = 0;
if ($i == "") $i = 0;
if ($b == "") $b = 0;
$content .= "<table border=\"0\" width=\"100%\">\n";
$content .= "<tr valign=\"middle\"><td colspan=\"2\" align=\"center\"><b>"._BVISIT."</b></td></tr>\n";
$content .= "<tr><td><img src=\"images/blocks/moderator.gif\"> "._BMEM.":</td><td align=\"right\"> $m</td></tr>\n";
$content .= "<tr><td><img src=\"images/blocks/guest.gif\"> "._BVIS.":</td><td align=\"right\"> $u</td></tr>\n";
if ($bots_check == 1) $content .= "<tr><td><img src=\"images/blocks/bots.gif\" title=\""._BBOTS."\" alt=\""._BBOTS."\" /> "._BBOTS.":</td><td align=\"right\"> $b</td></tr>";
$content .= "<tr><td><img src=\"images/blocks/group.gif\"> "._BOVER.":</td><td align=\"right\"> $i</td></tr></table>\n";
if ($who_online[0] != "") $content .= "<hr><table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"1\"><tr><td align=\"center\" colspan=\"2\"><b>"._BMEMVISIT."</b></td></tr><tr><td><table width=\"100%\" border=\"0\">$who_online[0]</table></td></tr></table>";
if ($bots_check == 1) if ($who_online[1] != "") $content .= "<hr><table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"1\"><tr><td align=\"center\" colspan=\"2\"><b>"._BOTSON."</b></td></tr><tr><td><table width=\"100%\" border=\"0\">$who_online[1]</table></td></tr></table>";
?>
Сообщение отредактировал ValeryL: Dec 13 2010, 16:25