Thread: Site Info Block
View Single Post
Old
  (#9 (permalink))
dar63
Moderator
 
dar63's Avatar
 
Status: Offline
Posts: 473
Join Date: Oct 2002
Location: UK
02-20-2003, 04:29 PM

The one I tried a while ago included the logout

Code:
<?php

/********************************************************/
/* Site Info Block for PHP-Nuke 5.5.0 thru 6.0.0        */
/* By: NukeScripts Network (webmaster@nukescripts.net)  */
/* http://www.nukescripts.net                           */
/* Copyright © 2002-2003 by NukeScripts Network         */
/********************************************************/

if (eregi("block-Site_Info_BB.php",$PHP_SELF)) { Header("Location: index.php"); }
$content = "";
global $nukeurl, $user, $cookie, $prefix, $user_prefix, $dbi, $anonymous;

// Total Users
if (is_user($user)) {
    $memname = $cookie[1];
    $content .= ""._BWEL.", $memname.
(<a href=\"modules.php?name=Your_Account&amp;op=logout\">"._BLOGOUT."</a>)\n";
    $content .= "<hr noshade size=\"1\">\n";
    if(is_active("Private_Messages")) {
        $result = sql_query("select uid from $user_prefix"._users." where uname='$memname'", $dbi);
        list($uid) = sql_fetch_row($result, $dbi);
        $result2 = sql_query("select privmsgs_to_userid from $prefix"._privmsgs." where privmsgs_to_userid='$uid' and privmsgs_type='1'", $dbi);
        $newpms = sql_num_rows($result2, $dbi);
        $result3 = sql_query("select privmsgs_to_userid from $prefix"._privmsgs." where privmsgs_to_userid='$uid' and privmsgs_type='0'", $dbi);
        $oldpms = sql_num_rows($result3, $dbi);
        $totpms = $newpms + $oldpms;
        $content .= "<a href=\"modules.php?name=Private_Messages\">"._BPM.":</a>
\n";
        $content .= "<big>&middot;</big> "._BUNREAD.": $newpms
\n";
        $content .= "<big>&middot;</big> "._BREAD.": $oldpms
\n";
        $content .= "<big>&middot;</big> "._BTT.": $totpms
\n";
        $content .= "<hr noshade size=\"1\">\n";
    }
} else {
    $content .= ""._BWEL.", $anonymous\n<hr noshade size=\"1\">";
    $content .= "<table border=0 cellpadding=0 cellspacing=0>\n";
    $content .= "<tr><form action=\"modules.php?name=Your_Account\" method=\"post\">\n";
    $content .= "<td>"._BNICK.": <input type=\"text\" name=\"uname\" size=\"10\" maxlength=\"25\">
\n";
    $content .= ""._BPASS.": <input type=\"password\" name=\"pass\" size=\"10\" maxlength=\"20\">
\n";
    $content .= "<input type=\"hidden\" name=\"op\" value=\"login\">\n";
    $content .= "<input type=\"submit\" value=\""._BLOGIN."\"> (<a href=\"modules.php?name=Your_Account&amp;op=new_user\">"._BREG."</a>)\n";
    $content .= "</td>\n";
    $content .= "</form></tr>\n";
    $content .= "</table>\n";
    $content .= "<hr noshade size=\"1\">\n";
}
//Formatting Current Date
$c_time = time();
$curDate = date("M d, Y",$c_time);
$result2 = sql_query("SELECT COUNT(UID) AS userCur from $user_prefix"._users." WHERE user_regdate='$curDate'", $dbi);
list($userCur) = sql_fetch_row($result2, $dbi);
$userCur = number_format($userCur, 0);
//Formatting Previous Date
$p_time = $c_time - 86400;
$preDate = date("M d, Y",$p_time);
$result3 = sql_query("SELECT COUNT(UID) AS userPre from $user_prefix"._users." WHERE user_regdate='$preDate'", $dbi);
list($userPre) = sql_fetch_row($result3, $dbi);
$userPre = number_format($userPre, 0);
//Print Membership
$totalmembers = 0;
$result = sql_query("select uname from $user_prefix"._users." order by uid DESC limit 0,1", $dbi);
list($lastuser) = sql_fetch_row($result, $dbi);
$totalmembers = sql_num_rows(sql_query("select uid from $user_prefix"._users."", $dbi), $dbi);
$totalmem = number_format($totalmembers, 0);
$content .= "<u>"._BMEMP.":</u>
\n";
$content .= "<big>&middot;</big> "._BLATEST.": <A HREF=\"modules.php?name=Your_Account&amp;op=userinfo&amp;uname=$lastuser\">$lastuser</a>
\n";
$content .= "<big>&middot;</big> "._BTD.": $userCur
\n";
$content .= "<big>&middot;</big> "._BYD.": $userPre
\n";
$content .= "<big>&middot;</big> "._BTT.": $totalmem
\n<hr noshade size=\"1\">\n";

/* Daily Membership */
$result = sql_query("SELECT count(*) FROM $prefix"._stats_date."", $dbi);
list($days) = sql_fetch_row($result, $dbi);
if ($days == 0) { $daily = 0; } else { $daily = number_format($totalmembers/$days, 0); }
/* Monthly Membership */
$result = sql_query("SELECT count(*) FROM $prefix"._stats_month."", $dbi);
list($months) = sql_fetch_row($result, $dbi);
if ($months == 0) { $monthly = 0; } else { $monthly = number_format($totalmembers/$months, 0); }
/* Yearly Membership */
$result = sql_query("SELECT count(*) FROM $prefix"._stats_year."", $dbi);
list($years) = sql_fetch_row($result, $dbi);
if ($years == 0) { $yearly = 0; } else { $yearly = number_format($totalmembers/$years, 0); }

$content .= "<u>"._BMEMA.":</u>
";
$content .= "<big>&middot;</big> "._BDAIL.": $daily
</center>";
$content .= "<big>&middot;</big> "._BMONT.": $monthly
\n";
$content .= "<big>&middot;</big> "._BYEAR.": $yearly
\n<hr noshade size=\"1\">\n";

// Total Hits
/* Hits for Today */
$t_time = time();
$t_year = date("Y", $t_time);
$t_month = date("n", $t_time);
$t_date = date("j", $t_time);
$result = sql_query("SELECT hits FROM $prefix"._stats_date." WHERE year='$t_year' AND month='$t_month' AND date='$t_date'", $dbi);
list($today) = sql_fetch_row($result, $dbi);
$today = number_format($today, 0);
/* Hits for Yesterday */
$y_time = $t_time - 86400;
$y_year = date("Y", $y_time);
$y_month = date("n", $y_time);
$y_date = date("j", $y_time);
$result = sql_query("SELECT hits FROM $prefix"._stats_date." WHERE year='$y_year' AND month='$y_month' AND date='$y_date'", $dbi);
list($yesterday) = sql_fetch_row($result, $dbi);
$yesterday = number_format($yesterday, 0);
/* Hits in Total */
$totalhits = 0;
$result = sql_query("SELECT hits FROM $prefix"._stats_year."", $dbi);
while(list($hits) = sql_fetch_row($result, $dbi)) {
    $totalhits = $totalhits + $hits;
}
$totalhit = number_format($totalhits, 0);
$content .= "<u>"._BHITS.":</u>
";
$content .= "<big>&middot;</big> "._BTD.": <a href=\"modules.php?name=Statistics&op=DailyStats&year=$t_year&month=$t_month&date=$t_date\">$today</a>
";
$content .= "<big>&middot;</big> "._BYD.": <a href=\"modules.php?name=Statistics&op=DailyStats&year=$y_year&month=$y_month&date=$y_date\">$yesterday</a>
</center>";
$content .= "<big>&middot;</big> "._BTT.": <a href=\"modules.php?name=Statistics\">$totalhit</a>
\n<hr noshade size=\"1\">\n";

/* Hourly Hits */
$result = sql_query("SELECT count(*) FROM $prefix"._stats_hour."", $dbi);
list($hours) = sql_fetch_row($result, $dbi);
if ($hours == 0) { $hours = 0; } else { $hourly = number_format($totalhits/$hours, 0); }
/* Daily Hits */
$result = sql_query("SELECT count(*) FROM $prefix"._stats_date."", $dbi);
list($days) = sql_fetch_row($result, $dbi);
if ($days == 0) { $days = 0; } else { $daily = number_format($totalhits/$days, 0); }
/* Monthly Hits */
$result = sql_query("SELECT count(*) FROM $prefix"._stats_month."", $dbi);
list($months) = sql_fetch_row($result, $dbi);
if ($months == 0) { $months = 0; } else { $monthly = number_format($totalhits/$months, 0); }
/* Yearly Hits */
$result = sql_query("SELECT count(*) FROM $prefix"._stats_year."", $dbi);
list($years) = sql_fetch_row($result, $dbi);
if ($years == 0) { $years = 0; } else { $yearly = number_format($totalhits/$years, 0); }

$content .= "<u>"._BHITA.":</u>
";
$content .= "<big>&middot;</big> "._BHOUR.": $hourly
";
$content .= "<big>&middot;</big> "._BDAIL.": $daily
</center>";
$content .= "<big>&middot;</big> "._BMONT.": $monthly
\n";
$content .= "<big>&middot;</big> "._BYEAR.": $yearly
\n<hr noshade size=\"1\">\n";

//Total Online
online();
$result2 = sql_query("SELECT uname,guest FROM $prefix"._session." where guest=0", $dbi);
$member_online_num = sql_num_rows($result2, $dbi);
$member_online_now = "";
$i = 1;
while ($session = sql_fetch_array($result2, $dbi)) {
    if (isset($session["guest"]) and $session["guest"] == 0) {
            $member_online_now .= "<big>&middot;</big> <A HREF=\"modules.php?name=Your_Account&amp;op=userinfo&amp;uname=$session[username]\">$session[username]</a>
\n";
        $member_online_now .= ($i != $member_online_num ? "  " : "");
        $i++;
    }
}
$result3 = sql_query("SELECT uname,guest FROM $prefix"._session." where guest=1", $dbi);
$guest_online_num = sql_num_rows($result3, $dbi);
$guest_online_now = "";
$i = 1;
while ($session = sql_fetch_array($result3, $dbi)) {
    if (isset($session["guest"]) and $session["guest"] == 1) {
            $guest_online_now .= "<big>&middot;</big> "._BGUES." $i
\n";
        $guest_online_now .= ($i != $guest_online_num ? "  " : "");
        $i++;
    }
}
$who_online_num = $guest_online_num + $member_online_num;
$content .= "<u>"._BON.":</u>\n
\n";
$content .= "<big>&middot;</big> "._BVIS.": $guest_online_num
\n";
$content .= "<big>&middot;</big> "._BMEM.": $member_online_num
\n";
$content .= "<big>&middot;</big> "._BTT.":$who_online_num\n<hr noshade size=\"1\">\n";
if ($member_online_num > 0) {
    $content .= "<u>"._BONM.":</u>
$member_online_now\n<hr noshade size=\"1\">\n";
}
if ($guest_online_num > 0) {
    $content .= "<u>"._BONG.":</u>
$guest_online_now\n<hr noshade size=\"1\">\n";
}

// Server Stats
$Today = date("d M Y");
$Time = date("H:i:s");
$Offset = date("O");
$content .= "<u>"._BSERV.":</u>
\n";
$content .= "<big>&middot;</big> "._BDT.": $Today
\n";
$content .= "<big>&middot;</big> "._BTM.": $Time
\n";
$content .= "<big>&middot;</big> "._GMT.": $Offset\n";

?>
Here are the defines for language-english.php also

/************************************************** ***/
/* From file : blocks/block-Site_Info.php */
/************************************************** ***/
define("_BDAIL","Daily");
define("_BDT","Date");
define("_BGUES","Guest");
define("_BHITA","Average Hits");
define("_BHITS","Total Hits");
define("_BHOUR","Hourly");
define("_BLATEST","Latest");
define("_BLOGIN","Login");
define("_BLOGOUT","Logout");
define("_BMEM","Members");
define("_BMEMA","Average Membership");
define("_BMEMP","Total Membership");
define("_BMONT","Monthly");
define("_BNICK","Username");
define("_BON","Online Now");
define("_BONG","Guests Online Now");
define("_BONM","Members Online Now");
define("_BPASS","Password");
define("_BPM","Private Messages");
define("_BREAD","Read");
define("_BREG","Register");
define("_BSERV","Server Stats");
define("_BTD","Today");
define("_BTM","Time");
define("_BTT","Total");
define("_BUNREAD","Unread");
define("_BVIS","Guests");
define("_BVISIT","Visitation");
define("_BWEL","Welcome");
define("_BYD","Yesterday");
define("_BYEAR","Yearly");
define("_GMT","GMT");
   
Reply With Quote