UBB.Dev
Posted By: Brett [6.7] [beta] User Online - 04/07/2004 11:40 AM
Modification Name: User Online

Author(s): Brett

Description: Adds a picture in each post to indicate whether the user is active on the forum at the moment or not. Recent Visitors must be enabled.

Demo: http://www.pavioni.com/ubb/ultimatebb.php/topic/4/8.asp#000011

Download Link: https://www.ubbdev.com/ubb/upload/00006378/Online6.7.zip

Credits: LK(for the idea of javascript from the hit hack)

This works in much of the same way as the hit hack, so the cache is safe. wink After install, clear the 'Topic Pages' cache.
Posted By: LK Re: [6.7] [beta] User Online - 04/07/2004 11:51 AM
Cool, good job! Going straight into my board.
By looking at the code, though, I think it also shows online state for invisible users, which don't want to appear online...
you might try (untested)
Code
if($r->{$uniq}->{login}->[1] == 1) {
before the last part of online.cgi.
Posted By: Brett Re: [6.7] [beta] User Online - 04/07/2004 12:35 PM
It looks like it might be the 2nd(3rd technically wink ) placement in the login array
Code
$r->{$uniq}->{logins}->{$uniq} = [$user_number, $nologin, $hidden, $daysprune];
as the hidden variable? At least i'm pretty sure it is.

Updated online.cgi. laugh
Posted By: LK Re: [6.7] [beta] User Online - 04/07/2004 12:45 PM
Just installed... and it works smile I think it'd be cool though that if the user is online it'd say "Online" or something like that when you hover the image, and if they're offline it'd say "Offline/Invisible". I'm not sure if it's possible in JS, but I think just instead of "src" you should put "alt".
Posted By: Brett Re: [6.7] [beta] User Online - 04/07/2004 12:59 PM
I am working in mozilla 1.6, and the .alt did work, but it didn't mouseover anything. .title does tho. jic, i left both alt and title in, since they both don't have any errors. Figuring 2 is better than 1, maybe there's a browser who will only accept alt, i dunno. wink
Posted By: Gizmo Re: [6.7] [beta] User Online - 04/07/2004 1:01 PM
[Linked Image]
[Linked Image]

i use those for my irc indicators heh
Posted By: LK Re: [6.7] [beta] User Online - 04/07/2004 1:03 PM
in Mozilla, ALT is when the image isn't available and title is when it is... In IE ALT is when the image is available and near the [x] when it isn't.
Posted By: Brett Re: [6.7] [beta] User Online - 04/07/2004 1:10 PM
hmm, never noticed that. Sweet, so it should be safe on all fronts. laugh
Posted By: LK Re: [6.7] [beta] User Online - 04/07/2004 1:18 PM
"ultimatebb.php/topic/4/8.asp" lol
Posted By: Gizmo Re: [6.7] [beta] User Online - 04/07/2004 1:44 PM
ultimatebb.php/topic/33/162.brett

:x
Posted By: Ian Spence Re: [6.7] [beta] User Online - 04/07/2004 4:56 PM
Using it on my forums and it looks great. You should use Gizzy's images in the zip cause Jelsoft might get pissed
Posted By: Gizmo Re: [6.7] [beta] User Online - 04/07/2004 5:12 PM
Quote
Originally posted by Ian Spence:

Using it on my forums and it looks great. You should use Gizzy's images in the zip cause Jelsoft might get pissed
IAN! Watch your language! I'm going to tell mom :x...
Posted By: Gizmo Re: [6.7] [beta] User Online - 04/07/2004 5:13 PM
Oh BTW, feel free to use my images, I give you complete rights to do so (at least i think I'm the one who made them, I've been so busy that I don't even recall lol, i've been using them for like 2 years now, and their crappy, so i'm pretty sure i made them)...
Posted By: Gizmo Re: [6.7] [beta] User Online - 04/07/2004 5:41 PM
I wonder how much it'd slow down your board having it in the directory...
Posted By: *Cartman* Re: [6.7] [beta] User Online - 04/08/2004 1:20 PM
this hack with VIPHTML and recicle bin rocks!

Brett #1 ! thumbsup
Posted By: Gizmo Re: [6.7] [beta] User Online - 04/10/2004 6:50 AM
I'm semi curious how this works with deleted members posts...
Posted By: Ian Spence Re: [6.7] [beta] User Online - 04/10/2004 6:58 AM
it doesn't show at all. no image whatsoever
Posted By: Brett Re: [6.7] [beta] User Online - 04/10/2004 9:44 AM
Designed Behaviorâ„¢ wink
Posted By: Gizmo Re: [6.7] [beta] User Online - 04/10/2004 8:39 PM
Nice nice nice... I plan on upgrading soon, so be prepaired...
Posted By: PhillipBurum Re: [6.7] [beta] User Online - 05/06/2004 8:00 AM
OK, so I get the "Offline" image, but never the online.


Where should I start looking?
Posted By: Brett Re: [6.7] [beta] User Online - 05/06/2004 9:10 AM
user_online.gif and user_offline.gif are located in the noncgi directory of the zip and should be uploaded into the respective directory on your webserver. smile
Posted By: PhillipBurum Re: [6.7] [beta] User Online - 05/06/2004 9:17 AM
That isn't the issue, the image shows up for offline, but I'm having a functionality issue in that it doesn't ever change to "online"...

I'm just not sure what file/part of code toggles that feature.
Posted By: Brett Re: [6.7] [beta] User Online - 05/06/2004 9:23 AM
For one, you do need recent visitors enabled. Also check to make sure you've uploaded online.cgi in ascii format and with 755 permissions.

If that doesn't work, can i get a link to your board?
Posted By: PhillipBurum Re: [6.7] [beta] User Online - 05/06/2004 3:32 PM
I forget there isn't a link to my board in my sig...


http://4.11.202.114/tin_benders/cgi-bin/ultimatebb.cgi


test:1234
Posted By: PhillipBurum Re: [6.7] [beta] User Online - 05/06/2004 3:41 PM
Quote
Originally posted by Brett:

For one, you do need recent visitors enabled. Also check to make sure you've uploaded online.cgi in ascii format and with 755 permissions.

If that doesn't work, can i get a link to your board?
These files are on my local disk, so there is no upload and chmod issue to deal with.
Posted By: Ian Spence Re: [6.7] [beta] User Online - 05/06/2004 4:45 PM
according to his online.cgi, it can't locate vars_config.
Posted By: PhillipBurum Re: [6.7] [beta] User Online - 05/06/2004 11:19 PM
Quote
Originally posted by Ian Spence:

according to his online.cgi, it can't locate vars_config.
Do I need to modify online.cgi? I placed it in the cgi-bin folder, along with all the other cgi's.
Posted By: Ian Spence Re: [6.7] [beta] User Online - 05/06/2004 11:21 PM
is it in the same folder as vars_config?
Posted By: PhillipBurum Re: [6.7] [beta] User Online - 05/06/2004 11:35 PM
Yes, it is in the came folder as vars_config.cgi (which is 701 bytes)
Posted By: GATOR420 Re: [6.7] [beta] User Online - 05/07/2004 3:44 AM
Found a couple of status gifs for this if anyone else would like to use them. Just did a random search on google for gifs of the same name.

[Linked Image]
[Linked Image]
Posted By: PhillipBurum Re: [6.7] [beta] User Online - 05/07/2004 4:35 AM
Help?
Posted By: Gizmo Re: [6.7] [beta] User Online - 05/07/2004 5:13 AM
shh, brett is sleeping... :x...
Posted By: PhillipBurum Re: [6.7] [beta] User Online - 05/07/2004 6:25 AM
Could there be something wrong with Vars_Config.cgi?

I even tried pointing to it directly (URL) within online.cgi, and it still didn't work although I can access the file via IE.
Posted By: Brett Re: [6.7] [beta] User Online - 05/07/2004 7:10 AM
did you have to change the location of vars_config.cgi in your ultimatebb.cgi and cp.cgi? Also you can't do url path to your config file, it's gotta be the full path. e.g. /usr/bin/local/path/file/ubbcgi/vars_config.cgi.

Quote
Originally posted by Gizzy:

shh, brett is sleeping... :x...
No, i wish. tipsy I work from 2 to 11 on thursday, had a very important project due today, couldn't mess around. :x
Posted By: PhillipBurum Re: [6.7] [beta] User Online - 05/07/2004 7:15 AM
I haven't changed the location of vars_config.cgi since the install. It is still in cgi-bin, the same folder that online.cgi is in.

I have returned the file online.cgi to it's original state, having altered it playing with paths.
Posted By: Brett Re: [6.7] [beta] User Online - 05/07/2004 7:25 AM
Ok, open up your ultimatebb.cgi, about line 122 it will have something like
Code
eval {
do "vars_config.cgi";
};
This is the exact same way in the upload file on line 72. They should be exactly the same, since their in the same directory.
Posted By: PhillipBurum Re: [6.7] [beta] User Online - 05/07/2004 7:32 AM
Software error:
Can't locate http://4.11.202.114/tin_benders/cgi-bin/vars_config.cgi in @INC (@INC contains: E:/Perl/lib E:/Perl/site/lib .) at E:inetpubwwwroottin_benderscgi-binonline.cgi line 9.
Posted By: PhillipBurum Re: [6.7] [beta] User Online - 05/07/2004 7:34 AM
eval {
do "vars_config.cgi";
};

Is how it looks in both now.


Same problem :tired and confused:

Software error:
Can't locate vars_config.cgi in @INC (@INC contains: E:/Perl/lib E:/Perl/site/lib .) at E:inetpubwwwroottin_benderscgi-binonline.cgi line 9.

For help, please send mail to this site's webmaster, giving this error message and the time and date of the error.
Posted By: Brett Re: [6.7] [beta] User Online - 05/07/2004 7:35 AM
Ok, change the http://4.11.202.114/tin_benders/cgi-bin/vars_config.cgi in ubb_upload.cgi to E:inetpubwwwroottin_benderscgi-binvars_config.cgi
Posted By: PhillipBurum Re: [6.7] [beta] User Online - 05/07/2004 7:47 AM
ubb_upload.cgi? I assume you mean online.cgi? This is what I get making that change to online.cgi because I don't have a ubb_upload.cgi


Software error:
Can't locate E:inetpubwwwroot in_bendersi-binvars_config.cgi in @INC (@INC contains: E:/Perl/lib E:/Perl/site/lib .) at E:inetpubwwwroottin_benderscgi-binonline.cgi line 9.

For help, please send mail to this site's webmaster, giving this error message and the time and date of the error.
Posted By: Brett Re: [6.7] [beta] User Online - 05/07/2004 8:17 AM
Whoops, thinking about the wrong hack. okay, replace:
require "vars_config.cgi";

with

eval {
do "vars_config.cgi";
};
Posted By: PhillipBurum Re: [6.7] [beta] User Online - 05/07/2004 6:02 PM
Ok, so I did that, and then I got the Error for the lext line of code, where it looks for vars_pntf. So I went and replaced it also. Now I get this if I try and run online.cgi by itself...

Code
 var AllImgs = document.body.getElementsByTagName("img"); function ChangeAll(img) { for(var i=0;
i <= AllImgs.length; i++) { if(AllImgs[i] && AllImgs[i].id == img) { AllImgs[i].src = '/user_online.gif';
AllImgs[i].alt = 'Online'; AllImgs[i].title = 'Online'; } // end if } // end for }
And the image doesn't change.
Posted By: Gizmo Re: [6.7] [beta] User Online - 05/08/2004 3:15 AM
That is a standard message when you run online.cgi by itself.
Posted By: PhillipBurum Re: [6.7] [beta] User Online - 05/08/2004 5:31 AM
Ok, so I replaced the standard "Require" code with
Code
 
eval {
do "vars_config.cgi";
};
eval {
do "vars_pntf.cgi";
};
ofcourse I get no errors, but it still doesn't work confused
Posted By: Brett Re: [6.7] [beta] User Online - 05/08/2004 6:33 AM
online.cgi doesn't log you. You/or another registered user needs to be on the boards. Also, the user must have hide pntf off.

n/m please check your private messages, phillip.
Posted By: GATOR420 Re: [6.7] [beta] User Online - 05/09/2004 9:04 PM
OK, I just tried to install this one and it semi-appears to work except for the big error I get when I click on a topic. Rehacked 3 times now.

"A Runtime Error has occured. Do you wish to debug?

Line:1
Error: Syntax error"

A picture does show up though and says I am offline.
Help? smile
Posted By: Ian Spence Re: [6.7] [beta] User Online - 05/09/2004 9:14 PM
it can't find vars_config
Posted By: LK Re: [6.7] [beta] User Online - 05/09/2004 9:18 PM
Al, it's in the JS code, not the Perl code... Also it's not surely line 1, IE's not so accurate when it comes to line numbers...
Posted By: GATOR420 Re: [6.7] [beta] User Online - 05/09/2004 9:26 PM
After going back over the thread I had to do what Phillip had to do in online.cgi. Wasn't exactly clear, but I figured it out. Replace

require "vars_config.cgi";
require "$vars_config {VariablesPath}/vars_pntf.cgi";

with

eval {
do "vars_config.cgi";
};
eval {
do "vars_pntf.cgi";
};

What's really interesting is that I replaced images, cleared cache, and it's still showing the old image for me being offline... How is that happening? I searched my entire www root directory for images of the same name and the one I want is the only one there???
Posted By: Ian Spence Re: [6.7] [beta] User Online - 05/09/2004 9:33 PM
Quote
Originally posted by LK:

Al, it's in the JS code, not the Perl code... Also it's not surely line 1, IE's not so accurate when it comes to line numbers...

the javascript is made by the perl, and Firefox gives you great javascript errors.
Posted By: GATOR420 Re: [6.7] [beta] User Online - 05/09/2004 11:31 PM
Hmm... I still can't get this to change status though. I always see offline also. Had another person register just to test and ask if they see me online which they don't, and I didn't see their online status change either. Any ideas?
Posted By: Brett Re: [6.7] [beta] User Online - 05/10/2004 12:49 AM
Looks like the same thing from Phillip's server. The way i fixed it was, okay do this. Download a fresh copy of the cgi file.

Code
replace:
use CGI ':standard';
use CGI::Carp qw(fatalsToBrowser set_message);

with:
BEGIN {
($0 =~ m!(.*)(\|/)[^/\]+!) && unshift(@INC, $1, "$1$2Modules");
$| = 1;
};
use lib("./Modules", ".");
use UBBCGI qw(:cgi);
use UBBCGI::Carp qw(fatalsToBrowser set_message);
Posted By: GATOR420 Re: [6.7] [beta] User Online - 05/10/2004 3:28 AM
Whoo Hoo! It worked! :::does a little dance::: Thanks for your help Brett.
Posted By: Painfool Re: [6.7] [beta] User Online - 06/20/2004 11:57 PM
Here are a couple of Status .gifs you are free to use if you like.

[Linked Image]
[Linked Image]

Enjoy!
Posted By: havoq Re: [6.7] [beta] User Online - 06/22/2004 3:29 PM
I'll add to that Painfool wink


[Linked Image]
[Linked Image]
Posted By: Tiger66 Re: [6.7] [beta] User Online - 02/11/2005 5:52 AM
very kewl smile

Is it possible to change the location of the offline/online images to show under the avatar or next to where it says " IP: Logged" at the bottom?
Posted By: Brett Re: [6.7] [beta] User Online - 02/11/2005 7:02 PM
Yes, you could put the image anywhere.
All in /non-cgi/Templates/public_topic_page.pl

If you want it under the avatar:
Replace:
$AvatarBits


with:
$AvatarBits

$OnlineBits


Or next to ip logged, just add the variable $OnlineBits after $ip_wording
Posted By: Tiger66 Re: [6.7] [beta] User Online - 02/12/2005 6:25 AM
Thanks thumbsup
Posted By: Wayne Harris Re: [6.7] [beta] User Online - 01/19/2007 7:34 AM
I have added this hack to my UBB 6.7.2.
The online status never changes from offline to online.
I do not receive any error messages.
I am certain that the required files are located in the correct directories.

My website is www.termpro.com (Click on Audio Forum).

I really, really want this feature. Any suggestions would be greatly appreciated.

Sincerely,

Wayne Harris
Posted By: AllenAyres Re: [6.7] [beta] User Online - 01/19/2007 5:40 PM
I'd re-check your changes to the base script files.
Posted By: Wayne Harris Re: [6.7] [beta] User Online - 01/19/2007 8:56 PM
When checking my server logs I am receiving an error "502 - Bad Gateway" whenever the online.cgi file is referenced. My server is Win 2003 Enterprise Edition with IIS.

The online.cgi script is as follows ...

#!/usr/bin/perl

# load modules
use strict;

BEGIN {
($0 =~ m!(.*)(\|/)[^/\]+!) && unshift(@INC, $1, "$1$2Modules");
$| = 1;
};
use lib("./Modules", ".");
use UBBCGI qw(:cgi);
use UBBCGI::Carp qw(fatalsToBrowser set_message);

use vars qw(%vars_config %vars_pntf);
require "vars_config.cgi";
require "$vars_config{VariablesPath}/vars_pntf.cgi";

print qq~Content-type: text/html\n\n
var AllImgs = document.body.getElementsByTagName("img");
function ChangeAll(img) {
for(var i=0; i <= AllImgs.length; i++) {
if(AllImgs[i] && AllImgs[i].id == img) {
AllImgs[i].src = '$vars_config{NonCGIURL}/user_online.gif';
AllImgs[i].alt = 'Online';
AllImgs[i].title = 'Online';
} // end if
} // end for
}
~;

if($vars_pntf{Enabled} eq "yes" && -e "$vars_config{CachePath}/pntf/now.cgi") {
do "$vars_config{CachePath}/pntf/now.cgi";
my $load = UBB::PNTF::_load();

foreach my $uniq (keys %{ $load->{uniq}->{logins} }) {
my $user = $load->{uniq}->{logins}->{$uniq}->[0];

# check to see if actual user or if hidden
next if $user eq '' || $load->{uniq}->{logins}->{$uniq}->[2] eq 1;


print qq~ChangeAll('online$user');\n~;
} # end if
} # end if

exit(0);
1;
Posted By: Wayne Harris Re: [6.7] [beta] User Online - 01/19/2007 8:58 PM
I am pretty sure that all of the security settings are correct. The requested url in the log file is /cgi-bin/ubb/online.cgi.

This is where all of my cgi scripts are located. This is also where the online.cgi file resides.

The offline graphic is showing up correctly on my pages and the online.cgi script is being called.

Your suggestions are appreciated.
Posted By: AllenAyres Re: [6.7] [beta] User Online - 01/21/2007 5:38 PM
Did you update the path to perl to match that of your ultimatebb.cgi file? I used to run ubbdev on a windows server for a few years and I believe the path to perl has to be set (usually something like c:\perl\perl.exe - it's been a while shocked )
© UBB.Developers