>>  Site Map >>  Forums >>  Installation 7x

Forum module - topics in forum:



Installation 7x - Discussions regarding PHP-Nuke Installation and Configuration. 7x



How does the who's online scripts work?? (techies please)

Hi guys

I have the who's online (site visitors block) installed on my site. This has been working for as long as I can remember. On the 31st December... the who's online part of the block can't count the number of people online and in turn does not display any member names.

No site content or code has been changed. I tried displaying the original PHPnuke Who's Online block and again this could not read the online users.

I am running PHPnuke 7.7

My guess is that the hosting company I am with had changed a config setting, so I contacted them and received this reply:

Quote: :
We do not make any modifications in the code and settings without your request. I can only suggest to refer to phpNuke support forum and if we need to make any modifications in the server configuration to make it work, just let us know. Thanks!


....... they have to have done something, but I do not know how this code works or how I advise them, I sent them a copy of the script but they are being as helpful as a chocolate teapot.

Please help guys!

Many Thanks!






First off:

http://phpnuke-uk.net/modules.php?name=Forums&file=viewtopic&p=26050

And if YOU have made no changes then THEY definately have if it suddenly stopped working.






Cant imagine your host would've played with your files but it could be down to the setup of the server time.

Does it do it on the default who is online nuke block too?






Quote: :

I tried displaying the original PHPnuke Who's Online block and again this could not read the online users


Razz @ Dar Twisted Evil






LOL Laughing oooops. Embarassed






Hi guys

Thanks very much for the replies.

I have had another occasion where my host has changed something and I had to contact them once more to unblock a certain port but this was for a connecting service so the whole reply about:

Quote: :
We do not make any modifications in the code and settings without your request.
is complete you know what.

Yes Dar I loaded up the default Who's Online which as you know just counts the number online and this is failing to work also. It is just ridiculous because as I have said above the site visitors block has been on my site for nearly 2 years without a problem.......... I have been away for Christmas and New Year so practically nothing has changed on site apart from forum postings.

Dar are you referring to the server time setup by the hosting company or PhpNuke itself? The problem does seem logical to be around that sort of sector. I initally thought my cookies had gone wrong, so obviously I deleted them all but still no change, all my users reporting the same problem.

Is there anything concrete I can reply to my hosting company, as you can see they are not very forthcoming with what they have changed over the last few days. Evil or Very Mad


I note you're in Plymouth Dar, im just down the road near Torquay lol - small world






What is your website where I can see it.


BL






Yes, I was referring to the hosts server time.

What about the whos online section on main admin page?

Yes, Plymouth, just down the road, like you say, small world.

Like Bluelion said, got a link to your site?






Hiya

Very sorry guys I cannot broadcast the site link as it is a club members sort of thing.

I can however show u this screen what the block looks like:




This is the script being used:

Code: :
<?php

/************************************************************************************/
/*                                                                                  */
/* BLOCK-SITE_VISITORS.PHP FOR PHP-Nuke running with phpBB                          */
/*                                                                                  */
/* Copyright 2003 by: Nuke Cops (zx@nukecops.com)                */
/* http://nukecops.com                            */
/* PHP-Nuke 6.5 and beyond modifications and additions.                */
/*                                  */
/* Copyright © 2002 by: Maty Scripts (webmaster@mat.allfreetemplates.com)           */
/* http://mat.allfreetemplates.com                                                  */
/* Updated for PHP-Nuke 5.6 WITH phpBB 2.0 / Nuke-Port 2.0.4.                       */
/* v1.4  31-07-2002                                                                 */
/*                                                                                  */
/* IDEA OF: Updated for PHP-Nuke 5.6 -  18 Jun 2002 NukeScripts                     */
/* website http://www.nukescripts.com                                               */
/*                                                                                  */
/* Original block: BLOCK_USER-INFO.PHP                                              */
/* Updated for PHP-Nuke 5.5 - 24/03/2002 Rugeri                                     */
/* website http://newsportal.homip.net                                              */
/*                                                                                  */
/* This program is free software. You can redistribute it and/or modify             */
/* it under the terms of the GNU General Public License as published by             */
/* the Free Software Foundation; either version 2 of the License.                   */
/*                                                                                  */
/* Modified and totally revamped by mikem of http://www.nukemods.com                */
/* added User Avatar feature                                                        */
/* re-did some graphics that were cheesy :-)                                        */
/************************************************************************************/

if ( eregi( "block-Site_Visitors.php", $PHP_SELF ) )
{
   Header(" Location: index.php" );
   die();
}

// Some definitions
global $user, $cookie, $prefix, $anonymous, $dbi, $user_prefix, $username, $stop, $module_name, $redirect, $mode, $t, $f, $admin, $userinfo;
$content = "";
getusrinfo($user);
cookiedecode( $user );
$ip = getenv( "REMOTE_ADDR" );
$username = $cookie[1];
if ( !isset( $username ) )
{
   $username = "$ip";
   $guest = 1;
}


// Set Nuke session table
$past = time()-900;
sql_query( "DELETE FROM $prefix"._users." 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 );
}

// Determine last registered user
$result = sql_query( "select username from $prefix"._users." order by user_id DESC limit 0,1", $dbi );
list( $lastuser ) = sql_fetch_row( $result, $dbi );
// Amount of registered users
$numrows = sql_num_rows( sql_query( "select user_id from $prefix"._users." where username != 'Anonymous'", $dbi ) );
// Amount of registered users online
$result2 = sql_query( "SELECT uname, guest FROM $prefix"._session." where guest=0", $dbi );
$member_online_num = sql_num_rows( $result2 );

// Assemble the online registered users
$who_online_now = "";
$i = 1;
while ( $session = sql_fetch_array( $result2, $dbi ) )
{
   if ( isset($session["guest"]) and $session["guest"] == 0 )
   {
      // Determine Location for Flag image
      $FlagResult = sql_query( "select user_from from ".$prefix."_users where username='$session[uname]'", $dbi );
      $FlagInfo =   sql_fetch_array( $FlagResult, $dbi );

      // Check if FLAG.GIF Exists
      $FlagPath = "images/forum/flags/";
      if( ( $FlagInfo[user_from] == "" ) OR ( file_exists( $FlagPath.$FlagInfo[user_from] ) == 0 ) )
      {
         $FlagPathFile = "images/visitors/quest.gif";
      }
      else
      {
         $FlagPathFile = $FlagPath.$FlagInfo[user_from];
      }

      // Get user ID's of online registered users
      $resultuser_id = sql_query( "SELECT user_id FROM ".$prefix."_users where username='$session[uname]'", $dbi );
      list( $user_id ) = sql_fetch_row( $resultuser_id, $dbi );
      // Merge Flag, online registered user and hyperlink to phpBB viewing profile
              if ($i < 10) {
      $who_online_now .= "0$i:&nbsp;<a href=\"modules.php?name=Private_Messages&mode=post&u=$user_id\"><img src=\"images/nopm.gif\" border=0 alt=\"Instant Message $session[uname]\" align=absmiddle></a><A HREF=\"modules.php?name=Forums&file=profile&mode=viewprofile&u=$user_id\">$session[uname]</a><br>\n";
              } else {
      $who_online_now .= "$i:&nbsp;<a href=\"modules.php?name=Private_Messages&mode=post&u=$user_id\"><img src=\"images/nopm.gif\" border=0 alt=\"Instant Message $session[uname]\" align=absmiddle></a><A HREF=\"modules.php?name=Forums&file=profile&mode=viewprofile&u=$user_id\">$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."%";

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

// Executing SQL Yesterday
$sql3 = "SELECT COUNT(user_id) AS userCount from $prefix"._users." WHERE user_regdate LIKE '$curDateP'";
$result3 = sql_query( $sql3, $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 );

$result = sql_query( "SELECT uname FROM $prefix"._session." where guest=0", $dbi );
$member_online_num = sql_num_rows( $result );

$who_online_num = $guest_online_num + $member_online_num;

// Display all information
if (is_user($user) )
{
   // Determine how many READ Messages and how many UNREAD Messages
   $result = sql_query( "select user_id from $prefix"._users." where username='$username'", $dbi);
   list( $user_id ) = sql_fetch_row( $result, $dbi );
   $result2 = sql_query( "select privmsgs_type from $prefix"._bbprivmsgs." where privmsgs_to_userid='$user_id' AND (privmsgs_type='1' or privmsgs_type='5' and privmsgs_from_userid='user_id')", $dbi );
   $MesUnread = sql_num_rows( $result2 );
   $result3 = sql_query( "select privmsgs_type from $prefix"._bbprivmsgs." where privmsgs_to_userid='$user_id' AND privmsgs_type='0'", $dbi );
   $MesRead = sql_num_rows( $result3 );

   // Info for users which is logged in
        if ( ereg( "(http)", $userinfo[user_avatar]) )
        {

}
else
if ($userinfo[user_avatar])
{

        }
   $content .= "<img src=images/visitors/anon.gif>"._SV_WELCOME."<b>&nbsp;".$username."</b><br>\n";
   $content .= "<img src=http://www.vultures-row.com/images/blocks/ball_r.gif>&nbsp&nbsp<a href=\"modules.php?name=Your_Account&op=logout\">Logout</a>\n";
   $content .= "<hr color=\"#000000\" size=\"1\">\n";
   $content .= "<img src=images/visitors/priv.gif>&nbsp<a href=\"modules.php?name=Private_Messages\"><b>"._SV_PRIVMSG."</b></a><br>\n";
   $content .= "<img src=images/visitors/upriv.gif>"._SV_UNREAD."<b>".$MesUnread."</b><br>\n";
   $content .= "<img src=images/visitors/rpriv.gif>"._SV_READ."<b>".$MesRead."</b><br>\n";
   $content .= "<hr color=\"#000000\" size=\"1\">\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 .="<form action=\"modules.php?name=Your_Account\" method=\"post\">\n";
$content .="<b>"._SV_USERLOGIN."</b><br><br>\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 .="<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";
}

// Info for users who logged in AND Guests
$content .= "<a href=\"modules.php?name=Members_List\"><img src=images/visitors/mem.gif border=\"0\" alt=\"Members List\"></a><b>"._SV_MEMBERS."</b><br>\n";

// Hyperlink last registered user to phpBB viewing profile
$resultName = sql_query( "SELECT user_id FROM ".$prefix."_users where username='$lastuser'", $dbi );
list( $Lastuser_id ) = sql_fetch_row( $resultName, $dbi );
$content .= "<img src=images/visitors/arrow.gif>"._SV_LATEST."<A HREF=\"modules.php?name=Forums&file=profile&mode=viewprofile&u=$Lastuser_id\"><b>$lastuser</b></a><br>\n";

$content .= "<img src=images/visitors/arrow.gif>"._SV_TODAY."<b>$userCount</b><br>\n";
$content .= "<img src=images/visitors/arrow.gif>"._SV_YESTERDAY."<b>$userCount2</b><br>\n";
$content .= "<img src=images/visitors/arrow.gif>"._SV_OVERALL."<b>$numrows</b><br>\n";
$content .= "<hr color=\"#000000\" size=\"1\">\n";
$content .= "<img src=images/visitors/visitors.gif><b>"._SV_VISITORS1."</b><br>\n";
$content .= "<img src=images/visitors/arrow.gif>"._SV_VISITORS2."<b>$guest_online_num</b><br>\n";
$content .= "<img src=images/visitors/arrow.gif>"._SV_VMEMBERS."<b>$member_online_num</b><br>\n";
$vtotal = $guest_online_num+$member_online_num;
$content .= "<img src=images/visitors/arrow.gif>"._SV_TOTAL."<b>$vtotal</b><br>\n";
$content .= "<hr color=\"#000000\" size=\"1\">\n";

if ( is_user( $user ) )
{
   // Show only registered online users to users who logged in
   $content .= "<img src=images/visitors/online.gif><b>"._SV_ONLINE."</b><br>$who_online $who_online_now";
}
else


?>


It slightly differs from the original code as features were erased which werent needed but this was done a very long time ago and has been working fine.






Above code is working ok as block. It does what it has to do.
Tested on 7.6pl3.1 and 7.7.

There must be something else wrong then.


BL






Hiya Lion,

Thankyou very very much for testing that! Narrows the problem down a bit........ I am stumped to what the problem maybe.

Hosting company still insists that they dont change anything without request but at the same time asking what server settings they should change in order to get the block reworking! How the hell should I know??? They won't tell me what they have changed from the 30th December for security purposes.... this is like banging your head against a brick wall. Sad




Attention! You are currently viewing sitemap page!
We strongly suggest to look at original content

Search from web

Valid HTML 4.01 Valid CSS