QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1029|回复: 4

版主勿入,网管请进

[复制链接]
发表于 2004-9-6 19:23:49 | 显示全部楼层 |阅读模式
我想看一下你们首页的

点击 今日: 60407
点击 昨日: 73141
最高: 167439 (2004/3/25)

是如何实现的。
请帮我将/nuke/blocks/block-User_Info.php文件源代码贴出来行吗?
非常感谢。
发表于 2004-9-6 19:27:56 | 显示全部楼层
[code:1]
<?php

/************************************************************/
/*                                                          */
/* Updated for PHP-Nuke 5.6 -  18 Jun 2002 NukeScripts      */
/* website http://www.nukescripts.com                       */
/*                                                          */
/* Updated for PHP-Nuke 5.5 - 24/03/2002 Rugeri             */
/* website http://newsportal.homip.net                      */
/*                                                          */
/* (C) 2002                                                 */
/* All rights beyond the GPL are reserved                   */
/*                                                          */
/* Please give a link back to my site somewhere in your own */
/*                                                          */
/************************************************************/

if (eregi("block-block-User_Info.php",$PHP_SELF)) { Header("Location: index.php"); }
$content = "";
global $user, $cookie, $prefix, $user_prefix, $dbi, $anonymous;
cookiedecode($user);
$username = $cookie[1];

$result = sql_query("select uname from $user_prefix"._users." order by uid DESC limit 0,1", $dbi);
list($lastuser) = sql_fetch_row($result, $dbi);
$numrows = sql_num_rows(sql_query("select uid from $user_prefix"._users."", $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) {
        if ($i < 10) {
            $who_online_now .= "0$i: <A HREF=\"modules.php?name=Your_Account&op=userinfo&uname=$session[username]\">$session[username]</a><br>\n";
        } else {
            $who_online_now .= "$i: <A HREF=\"modules.php?name=Your_Account&op=userinfo&uname=$session[username]\">$session[username]</a><br>\n";
        }
        $who_online_now .= ($i != $member_online_num ? "  " : "");
        $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."%";

//Executing SQL Today
$result2 = sql_query("SELECT COUNT(UID) AS userCount from $user_prefix"._users." WHERE user_regdate LIKE '$curDate2'", $dbi);
list($userCount) = sql_fetch_row($result2, $dbi);
//end

//Executing SQL Today
$result3 = sql_query("SELECT COUNT(UID) AS userCount from $user_prefix"._users." WHERE user_regdate LIKE '$curDateP'", $dbi);
list($userCount2) = sql_fetch_row($result3, $dbi);
//end

$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;
$content .= "<form action=\"modules.php?name=Your_Account\" method=\"post\">";

if (is_user($user)) {
    $content .= "<br><img src=\"images/blocks/group-4.gif\" height=\"14\" width=\"17\"> "._BWEL.", <b>$username</b>.<br>\n<hr>\n";
    $result = sql_query("select uid from $user_prefix"._users." where uname='$username'", $dbi);
    list($uid) = sql_fetch_row($result, $dbi);
    $result2 = sql_query("select to_userid from $prefix"._priv_msgs." where to_userid='$uid' and read_msg='0'", $dbi);
    $newpms = sql_num_rows($result2, $dbi);
    $result3 = sql_query("select to_userid from $prefix"._priv_msgs." where to_userid='$uid' and read_msg='1'", $dbi);
    $oldpms = sql_num_rows($result3, $dbi);
    $content .= "<img src=\"images/blocks/email-y.gif\" height=\"10\" width=\"14\"> <a href=\"modules.php?name=Private_Messages\"><b>"._BPM."</b></a><br>\n";
    $content .= "<img src=\"images/blocks/email-r.gif\" height=\"10\" width=\"14\"> "._BUNREAD.": <b>$newpms</b><br>\n";
    $content .= "<img src=\"images/blocks/email-g.gif\" height=\"10\" width=\"14\"> "._BREAD.": <b>$oldpms</b><br>\n<hr>\n";
} else {
    $content .= "<img src=\"images/blocks/group-4.gif\" height=\"14\" width=\"17\"> "._BWEL.", <b>$anonymous</b>\n<hr>";
    $content .= ""._NICKNAME." <input type=\"text\" name=\"uname\" size=\"10\" maxlength=\"25\"><br>";
    $content .= ""._PASSWORD." <input type=\"password\" name=\"pass\" size=\"10\" maxlength=\"20\"><br>";
    $content .= "<input type=\"hidden\" name=\"op\" value=\"login\">";
    $content .= "<input type=\"submit\" value=\""._LOGIN."\">\n (<a href=\"modules.php?name=Your_Account&op=new_user\">"._BREG."</a>)<hr>";
}
$content .= "<img src=\"images/blocks/group-2.gif\" height=\"14\" width=\"17\"> <b><u>"._BMEMP.":</u></b><br>\n";
$content .= "<img src=\"images/blocks/ur-moderator.gif\" height=\"14\" width=\"17\"> "._BLATEST.": <A HREF=\"modules.php?name=Your_Account&op=userinfo&uname=$lastuser\"><b>$lastuser</b></a><br>\n";
$content .= "<img src=\"images/blocks/ur-author.gif\" height=\"14\" width=\"17\"> "._BTD.": <b>$userCount</b><br>\n";
$content .= "<img src=\"images/blocks/ur-admin.gif\" height=\"14\" width=\"17\"> "._BYD.": <b>$userCount2</b><br>\n";
$content .= "<img src=\"images/blocks/ur-guest.gif\" height=\"14\" width=\"17\"> "._BOVER.": <b>$numrows</b><br>\n<hr>\n";
$content .= "<img src=\"images/blocks/group-3.gif\" height=\"14\" width=\"17\"> <b><u>"._BVISIT.":</u></b>\n<br>\n";
$content .= "<img src=\"images/blocks/ur-anony.gif\" height=\"14\" width=\"17\"> "._BVIS.": <b>$guest_online_num</b><br>\n";
$content .= "<img src=\"images/blocks/ur-member.gif\" height=\"14\" width=\"17\"> "._BMEM.": <b>$member_online_num</b><br>\n";
$content .= "<img src=\"images/blocks/ur-registered.gif\" height=\"14\" width=\"17\"> "._BTT.": <b>$who_online_num</b><br>\n";
if ($member_online_num > 0) {
    $content .= "<hr>\n<img src=\"images/blocks/group-1.gif\" height=\"14\" width=\"17\"> <b><u>"._BON.":</u></b><br>$who_online_now";
}
$content .= "</form>";

[/code:1]
回复

使用道具 举报

发表于 2004-9-6 19:28:38 | 显示全部楼层
似乎是 nuke 本来就有的吗? 不清楚了. 文件就这个了. 你参考一下.
回复

使用道具 举报

 楼主| 发表于 2004-9-6 19:32:14 | 显示全部楼层
谢谢回复。
好像不是我需要的呀。
后面再没有了吗?
我需要后面的显示语句呀
回复

使用道具 举报

 楼主| 发表于 2004-9-6 21:53:04 | 显示全部楼层
此问题我已解决。block-User_Info.php修改后为:
[code:1]
<?php

/************************************************************/
/*                                                          */
/* Updated for PHP-Nuke 5.6 -  18 Jun 2002 NukeScripts      */
/* website http://www.nukescripts.com                       */
/*                                                          */
/* Updated for PHP-Nuke 5.5 - 24/03/2002 Rugeri             */
/* website http://newsportal.homip.net                      */
/*                                                          */
/* (C) 2002                                                 */
/* All rights beyond the GPL are reserved                   */
/*                                                          */
/* Please give a link back to my site somewhere in your own */
/*                                                          */
/************************************************************/

if (eregi("block-block-User_Info.php",$_SERVER['PHP_SELF'])) {
    Header("Location: index.php");
}

$content = "";

global $user, $cookie, $prefix, $user_prefix, $db, $anonymous, $sitekey,$nukeurl, $startdate,$dbi;
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];

$sql = "SELECT uname FROM $user_prefix"._users." ORDER BY uid DESC LIMIT 0,1";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$lastuser = $row[username];
$numrows = $db->sql_numrows($db->sql_query("SELECT uid FROM $user_prefix"._users.""));

$sql = "SELECT uname, guest FROM $prefix"._session." WHERE guest=0";
$result = $db->sql_query($sql);
$member_online_num = $db->sql_numrows($result);
$who_online_now = "";
$i = 1;
while ($session = $db->sql_fetchrow($result)) {
    if (isset($session["guest"]) and $session["guest"] == 0) {
        if ($i < 10) {
            $who_online_now .= "0$i: <A HREF=\"modules.php?name=Your_Account&op=userinfo&username=$session[uname]\">$session[uname]</a><br>\n";
        } else {
            $who_online_now .= "$i: <A HREF=\"modules.php?name=Your_Account&op=userinfo&username=$session[uname]\">$session[uname]</a><br>\n";
        }
        $who_online_now .= ($i != $member_online_num ? "  " : "");
        $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."%";

//存取统计---总浏览次数$totalhits
$sql = "SELECT count FROM ".$prefix."_counter WHERE type='total' AND var='hits'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$totalhits =$row[0];

//存取统计---最多人的日子$mosthits
$result = sql_query("select year, month, date, hits from ".$prefix."_stats_date order by hits DESC limit 0,1", $dbi);
    list($year, $month, $date, $hits) = sql_fetch_row($result, $dbi);
    if ($month == 1) {$month = _JANUARY;} elseif ($month == 2) {$month = _FEBRUARY;} elseif ($month == 3) {$month = _MARCH;} elseif ($month == 4) {$month = _APRIL;} elseif ($month == 5) {$month = _MAY;} elseif ($month == 6) {$month = _JUNE;} elseif ($month == 7) {$month = _JULY;} elseif ($month == 8) {$month = _AUGUST;} elseif ($month == 9) {$month = _SEPTEMBER;} elseif ($month == 10) {$month = _OCTOBER;} elseif ($month == 11) {$month = _NOVEMBER;} elseif ($month == 12) {$month = _DECEMBER;}
$mosthits= "<center>"._MOSTHITS.": $hits<br> ($date $month $year)</center><br>";

//存取统计---点击 今日$nowdatehits,昨日$yestdayhits
$now = date("d-m-Y");
$dot = explode ("-",$now);
$nowdate = $dot[0];
$yesterday=$nowdate-1;
$nowmonth = $dot[1];
$nowyear = $dot[2];
$sql="select hits from ".$prefix."_stats_date where year='$nowyear' and month='$nowmonth' and date='$yesterday'";
$result =$db->sql_query($sql);
$row=$db->sql_fetchrow($result);
$yestdayhits= "<center>"._YESTAYDATHITS.": <B><A href=\"modules.php?name=Statistics&op=DailyStats&year=$nowyear&month=$nowmonth&date=$yesterday\">$row[0]</a></B><br></center>";

$sql="select hits from ".$prefix."_stats_date where year='$nowyear' and month='$nowmonth' and date='$nowdate'";
$result =$db->sql_query($sql);
$row=$db->sql_fetchrow($result);
$nowdatehits= "<center>"._TODAYHITS.": <B><A href=\"modules.php?name=Statistics&op=DailyStats&year=$nowyear&month=$nowmonth&date=$nowdate\">$row[0]</a></B><br></center>";

//Executing SQL Today
$sql = "SELECT COUNT(user_id) AS userCount FROM $user_prefix"._users." WHERE user_regdate LIKE '$curDate2'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$userCount = $row[userCount];
//end

//Executing SQL Today
$sql = "SELECT COUNT(user_id) AS userCount FROM $user_prefix"._users." WHERE user_regdate LIKE '$curDateP'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$userCount2 = $row[userCount];
//end

$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\">";

if (is_user($user)) {
    $content .= "<br><img src=\"images/blocks/group-4.gif\" height=\"14\" width=\"17\"> "._BWEL.", <b>$uname</b>.<br>\n<hr>\n";
    $sql = "SELECT uid FROM $user_prefix"._users." WHERE uname='$uname'";
    $result = $db->sql_query($sql);
    $row = $db->sql_fetchrow($result);
    $uid = $row[user_id];
    $newpms = $db->sql_numrows($db->sql_query("SELECT privmsgs_to_userid FROM $prefix"._bbprivmsgs." WHERE privmsgs_to_userid='$uid' AND (privmsgs_type='5' OR privmsgs_type='1')"));
    $oldpms = $db->sql_numrows($db->sql_query("SELECT privmsgs_to_userid FROM $prefix"._bbprivmsgs." WHERE privmsgs_to_userid='$uid' AND privmsgs_type='0'"));
    $content .= "<img src=\"images/blocks/email-y.gif\" height=\"10\" width=\"14\"> <a href=\"modules.php?name=Private_Messages\"><b>"._BPM."</b></a><br>\n";
    $content .= "<img src=\"images/blocks/email-r.gif\" height=\"10\" width=\"14\"> "._BUNREAD.": <b>$newpms</b><br>\n";
    $content .= "<img src=\"images/blocks/email-g.gif\" height=\"10\" width=\"14\"> "._BREAD.": <b>$oldpms</b><br>\n<hr>\n";
} else {
    $content .= "<img src=\"images/blocks/group-4.gif\" height=\"14\" width=\"17\"> "._BWEL.", <b>$anonymous</b>\n<hr>";
    $content .= ""._NICKNAME." <input type=\"text\" name=\"username\" size=\"10\" maxlength=\"25\"><br>";
    $content .= ""._PASSWORD." <input type=\"password\" name=\"pass\" size=\"10\" maxlength=\"20\"><br>";
    $content .= "<input type=\"hidden\" name=\"random_num\" value=\"$random_num\">";
    $content .= "<input type=\"hidden\" name=\"gfx_check\" value=\"$code\">";
    $content .= "<input type=\"hidden\" name=\"op\" value=\"login\">";
    $content .= "<input type=\"submit\" value=\""._LOGIN."\">\n (<a href=\"modules.php?name=Your_Account&op=new_user\">"._BREG."</a>)<hr>";
}
$content .= "<img src=\"images/blocks/group-2.gif\" height=\"14\" width=\"17\"> <b><u>"._BMEMP.":</u></b><br>\n";
$content .= "<img src=\"images/blocks/ur-moderator.gif\" height=\"14\" width=\"17\"> "._BLATEST.": <A HREF=\"modules.php?name=Your_Account&op=userinfo&username=$lastuser\"><b>$lastuser</b></a><br>\n";
$content .= "<img src=\"images/blocks/ur-author.gif\" height=\"14\" width=\"17\"> "._BTD.": <b>$userCount</b><br>\n";
$content .= "<img src=\"images/blocks/ur-admin.gif\" height=\"14\" width=\"17\"> "._BYD.": <b>$userCount2</b><br>\n";
$content .= "<img src=\"images/blocks/ur-guest.gif\" height=\"14\" width=\"17\"> "._BOVER.": <b>$numrows</b><br>\n<hr>\n";
$content .= "<img src=\"images/blocks/group-3.gif\" height=\"14\" width=\"17\"> <b><u>"._BVISIT.":</u></b>\n<br>\n";
$content .= "<img src=\"images/blocks/ur-anony.gif\" height=\"14\" width=\"17\"> "._BVIS.": <b>$guest_online_num</b><br>\n";
$content .= "<img src=\"images/blocks/ur-member.gif\" height=\"14\" width=\"17\"> "._BMEM.": <b>$member_online_num</b><br>\n";
$content .= "<img src=\"images/blocks/ur-registered.gif\" height=\"14\" width=\"17\"> "._BTT.": <b>$who_online_num</b><br>\n";
if ($member_online_num > 0) {
    $content .= "<hr>\n<img src=\"images/blocks/group-1.gif\" height=\"14\" width=\"17\"> <b><u>"._BON.":</u></b><br>$who_online_now";
}

$content .= "<hr><center>"._WERECEIVED."<br><b><a href=\"modules.php?name=Statistics\">$totalhits</a></b><br>"._PAGESVIEWS." $startdate</center>";
$content .="<hr>".$nowdatehits.$yestdayhits.$mosthits;

$content .= "</form>";

?>[/code:1]
在nuke/language/lang-chinese.php中加入
[code:1]
define("_TODAYHITS","点击 今日");
define("_YESTAYDATHITS","点击 昨日");
define("_MOSTHITS","最高");
[/code:1]
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-11-22 17:01 , Processed in 0.085174 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表