PDA

View Full Version : [Release v2 beta 3] Who's online on non-vB page (with usernames)


tubedogg
Wed 21st Mar '01, 7:31pm
LAST UPDATED: 3.24.01 10:40 PM Eastern

Hack version: 0.0.2

Changes since last version: New option to display either usernames or a total number of registered members.

For version: 2.0.0 beta 3 (possibly beta 1 and beta 2 also, but it's untested on those versions).

Files needed: online.php (see zip file attached below).

Files to edit: Possibly online.php (see instructions below).

Possible file locations: Anywhere, as long as the relative path to config.php is correct (see instructions below).

Instructions
1] Download the zip file online002.zip below. It has online.php in it; unzip this file to a location on your hard drive.
2] Open online.php in Notepad (Windows) or Simpletext (Mac) or another ASCII text editor (EditPlus, UltraEdit, TextPad, etc. Dreamweaver, FrontPage, and other HTML editors are not ASCII text editors and will in all likelyhood screw the file up.)
3] Check the path to config.php in the $path variable (in the CONFIG section). Figure out where you're gonna put the file online.php, and then edit the path accordingly. For example, if you put it in your document root (e.g. yoursite.com/) and your board files are in a directory called forum, your path is "forum/admin" (no quotes, no trailing slash).
4] If you want usernames of registered members displayed, then leave the $usernames option alone. If you want a number instead of a list of names, set this to "off" (no quotes).
5] Edit the second-to-last line (the "echo" line). Change it to say what you want. The list of registered members is $regmemberson and the number of guests is $guestson - you can use these anywhere in that line.
6] Save the file and upload it your server.
7] You can include it on another page one of two basic ways:
First, by a PHP include:
<? include("online.php"); ?>
The file that you are going to be including online.php in must then have a .php, .php3, .phtml or other extension that makes your web server recognize it as a file to be parsed as PHP.
Secondly, by an SSI include:
<!--#include file="online.php"-->
The file that you are going to be including online.php in must then have a .shtml, .shtm or other extension that makes your web server recognize it as a file to be server-parsed.

Instructions are also included in the zip file (online002.txt) and brief notes are in the online.php file itself.

FEEDBACK WANTED! :D Likes/dislikes/modification requests all gladly accepted!

Blue2000
Wed 21st Mar '01, 10:50pm
your the man dude

this is pop and just what i was looking for :)

DeMoN
Thu 22nd Mar '01, 5:05pm
hey thanx ure gr8! now time for bdays to work :)

Joshs
Sat 24th Mar '01, 5:11pm
Okay sorry for asking this, I am not that knowledgeable when it comes to things like this...

Okay... I have http://tech.hytekcomputer.com/online.php working and everything. Now how can I integrate that into http://tech.hytekcomputer.com on the main page so it shows that? If it helps, I am using Front Page 2000 to edit the site...

Thanks in advance!

tubedogg
Sat 24th Mar '01, 7:24pm
You must "include" it as described in the instructions above. I would *not* use FrontPage to do it as it will probably screw up the code. Open your page in notepad, find where you want to include it, and put the code in that way. Your page must have an extension of .php or .shtml for it to work, and depending on the extension depends on how you include it.

Robert Basil
Sat 24th Mar '01, 8:48pm
tubedogg,

Great hack! It's the first one I have seen that does not require visitors to visit the forum first before they can see the "online" usercount.

I am trying to change the above hack so instad of showing the usernames of the "Members" it will only show a count of the members online (like the "Guests" count for this hack).

I am trying to figure out where VB get's the $numberregistered variable from but cannot find it in any of the php files.

Any hints?

tubedogg
Sat 24th Mar '01, 10:20pm
vB gets the $numberregistered from index.php.

<snipped info about how to change hack - see EDIT below>

EDIT: I revised the hack (updated to version 0.0.2) to allow you to choose whether to show usernames or a number, so the code that was in this post is now standard-issue. See the first post in this thread.

RobAC
Sun 25th Mar '01, 11:14am
Nice job tubedogg. I implemented this hack on to my homepage and will be updating it to the new release from yesterday. Thanks.

jojo85
Sun 25th Mar '01, 12:08pm
Wiil update it on
www.ishparentsboards.com :)

DroppedAtBirth
Sat 5th May '01, 8:12pm
I am trying to use your online script thru a template. But the template doesn't seem to pickup the variables from the page. How do I make the template see the variables?

badmeetsevil
Sat 12th May '01, 9:22pm
I seem to be getting "oops1"... what is that, and how do I fix it?

tubedogg
Sat 12th May '01, 9:34pm
It can't complete the first query for some reason.

Try replacing
$db=mysql_connect($servername,$dbusername,$dbpassw ord);
mysql_select_db($dbname);
with
$db=mysql_connect($servername,$dbusername,$dbpassw ord) or die("can't connect");
mysql_select_db($dbname) or die("can't get db");
and tell me if you still get the same error or a different error.

badmeetsevil
Sat 12th May '01, 10:39pm
Yes.. I'm still getting the same error message.. "oops1".

badmeetsevil
Sat 12th May '01, 10:40pm
I'm also not running on VB 2.. but, it should work, shouldn't it?

tubedogg
Sat 12th May '01, 10:54pm
You must be running vB2 of some variety (beta 1, 2, 3, 4, or 5, or RC1, 2, or 3). It will not work with v1.1.x. Sorry.

Byron
Sun 13th May '01, 3:58am
Hi Kevin,

Thanks for this useful hack.

Do you think it is possible to further customise the message shown?

Re: 1 guest/member
instead of showing the message as 1 guests online.
notice the pural for guest?
show msg as "There is 1 guest online."
same thing for 0 members

Re: 0 guest/member
So if's it O members online and 2 guests online.
Instead of showing msg as "0 members and 2 guests online"
Show message as: "2 guests online" and don't show the o members part.

same thing for 0 guest.

And don't show any message if there are o member and o guest online.



Re: warning msg
I have a few layers of includes for my site, when i use the script
it shows

Warning: MySQL Connection Failed: Access denied for user: 'XXXXXXX@localhost' (Using password: NO) in /home/XXXXX/public_html/online.php on line 46

It works after i added the two following lines just above $db=mysql_connect($servername,$dbusername,$dbpassw ord);

$dbusername="myusername";
$dbpassword="mypassword";

Mitrofan
Sun 13th May '01, 11:47am
I just installed this hack and it works well, I also added a small code to also show the total number of registered members:

$usernum = mysql_query("Select count(*) from user");
$users = mysql_fetch_array($usernum);

Then just put $users[0] where you want to display total members

Anyway, my problem is that when I turn off the usernames and want to only display the number of members online, the number of members seems to be much higher than what is says on the forum home page under logged in members.

For example on my forum home page it may say 34 members and 80 guests, and using this hack it would say 70 members and 80 guests online

It seems that it correctly reports the number of guests online, but the number of members is too high.

When I set $usernames to 'on', then it shows the same users as on the forum home page under users online, so the only incosistency with the total users online is when I turn the $usernames off.

What can I do to fix this?

Hooper
Mon 14th May '01, 7:26pm
I have a fresh install with no hacks. I am trying to figure out why when this SSI'd to the front page always shows (1) Guest online no matter what. Then if I log in it goes to (0)guests (1)Member.

This is what I was having a problem with before. Should it not have (0) for both when noone is in the forums?

Update: It does go back to (0)'s for both after about a half hour or so. What causes the delay?

Thanks
Hooper

Byron
Thu 24th May '01, 11:31am
feedback:

The script is showing 8 members and 2 guests online

while forums is showing

currently 3 members and 2 guests on the boards.

Degen
Fri 25th May '01, 4:34pm
Great hack! I have the same problem as Byron. It is because of the cookies. Not sure if anything can be done about that.

Joshs
Wed 20th Jun '01, 11:50pm
When I include this in a .shtml file I get this when viewing it...

$datecut AND invisible='0' ORDER BY username ASC") or die("oops2"); while($regmember = mysql_fetch_array($regmembers)): ++$regmembercomma; if ($regmember[invisible] == 0) { $regmemberson .= $regmember[username]; } else { ++$regmembercomma; } if ($regmembercomma < mysql_num_rows($regmembers)): $regmemberson .= ", "; endif; endwhile; $guests = mysql_query("SELECT COUNT(userid) AS guestsonline FROM session WHERE userid=0 AND session.lastactivity>$datecut") or die("oops3"); while($guest = mysql_fetch_array($guests)): $guestson = number_format($guest[guestsonline]); endwhile; echo("Member(s) on: $regmemberson. Guest(s) on: $guestson."); ?>

jarvis
Thu 21st Jun '01, 12:18am
Joshs,

Are you using WinNT/2k and IIS?

Joshs
Thu 21st Jun '01, 12:21am
Yes!

jarvis
Thu 21st Jun '01, 12:27am
Well, you and I are out of luck. Apparently IIS does not know how to handle multiple layers of translation.

Trying to include a .PHP document in IIS confuses it and IIS does not apply the filter. :(

Sorry to be the bearer if bad news.

Joshs
Thu 21st Jun '01, 12:30am
Oh s***! I was planning on integrating some of this stuff with my site!!!! So there is no way to get this working?!

jarvis
Thu 21st Jun '01, 12:33am
I've heard mixed reports with .asp pages, but I really don't have time to learn ASP.

I'm browsing through MS again to see if there are any white papers on this. :(

Grover
Sun 24th Jun '01, 10:14am
Great 'hack', this Tubedogg. Just what I was looking for.

Is it possible that you could include some of the suggestions of us - the VERY satisfied users of your work- in a future release of this hack?

I would LOVE to see some extenions on this, for example the suggestion of Mitrofan to include just the number of registered members, regardless of their online status.
Instead of including the suggestions of Mitrofan or doing the adaptions ourselves, it would be nice to include it in a future release?

Thank you very much, again. (none of my bussiness really, but do you actually get PAID for all the great support you do on Vb? Ofcourse, it must be....nevertheless I'm willing to start a Poll to get you a raise ;)

Grover.

(PS: I guess this hack works on 2.0.0 and 2.0.1 as well? 'cause it says ' v2 beta 3 in the subjectline)

VirtueTech
Sun 22nd Jul '01, 1:58am
nevermind

nice hack :)

Cygnus
Wed 1st Aug '01, 1:28pm
Originally posted by tubedogg
LAST UPDATED: 3.24.01 10:40 PM Eastern

Hack version: 0.0.2

Will there be an upgrade to this soon? With vB 2.0.3 out, the sessions.php file has changed. Further, I have always seen two or three entries for some people. I have read the thread and understand the problem, but I am sure that there must be a fix. As I only picked up a PHP book yesterday, I am not quite qualified to do it and hope that some coder here (maybe even tubedogg himself) to fix up what could be the most useful hack for a board.

Thanks in advance!
Cygnus

Cygnus
Mon 13th Aug '01, 11:10pm
bump.

Tubedogg? You out there? Anyone else?

Cygnus

Cygnus
Tue 14th Aug '01, 11:13pm
the hack is not currently working as the changes in 2.0.3 changed the sessions.php file. All people on the boards are currently listed as "browsing the boards" which kind of defeats the purpose of the hack, no? I mean... obviously they're browsing the boards...

Cygnus

tubedogg
Wed 15th Aug '01, 1:23am
The hack does not list where anyone is, it never has.

I may update it for 2.0.3 in the future, I may not. I don't know at this point.

tubedogg
Wed 15th Aug '01, 1:36am
Now that I think about it, the session table was barely changed, and nothing that was changed would affect this hack in the least...Are you sure you're talking about the right hack???

Cygnus
Thu 16th Aug '01, 4:17pm
Originally posted by tubedogg
Are you sure you're talking about the right hack???

Uh... I believe so. Is this the hack which shows who is online and doing what (i.e. Reading this post in this thread)? If not intended to do so - and seeing that this is the only hack that I have installed - it would be pretty odd if it was doing it, no?

Cygnus

amykhar
Thu 16th Aug '01, 7:16pm
Cygnus,
What you are describing is a bug in 2.0.3 itself. A fix is in the bugs forum.

Amy

evoir
Thu 16th Aug '01, 8:07pm
Tubedogg,

Thanks for the great hack. One question: is there a way to make the script simply output the total number of people on the boards, rather than seperating the members from the guests?

I'd like it to say: "there are currently x people on our boards."

Thanks again,
Evoir

Cygnus
Wed 22nd Aug '01, 1:49pm
Originally posted by amykhar
What you are describing is a bug in 2.0.3 itself. A fix is in the bugs forum.

Are you talking about this one: http://vbulletin.com/forum/showthread.php?threadid=25832

If so... I fixed this just now and see no changes yet. I will give it a few minutes so that the sessions table can be filled with new data...

Cygnus

Cygnus
Wed 22nd Aug '01, 2:20pm
OK... tried that one... no luck. I switched it back.

I also tried this one...
http://vbulletin.com/forum/showthread.php?threadid=25521

Still no luck.

Any chance you could tell me which bug? :)

Thanks,
Cygnus

Cygnus
Fri 24th Aug '01, 2:24am
Bueller?

Bueller?

Bueller?

I have uninstalled this now useless hack. Thanks for all of the attention that I... well... didn't get.

Cygnus, who would service hacks he writes... otherwise... why write them?

tubedogg
Fri 24th Aug '01, 2:26am
This hack never showed where people are and in fact it works perfectly for me on 2.0.3...

LuBi
Sun 26th Aug '01, 10:46am
Is 2.0.3 Version 2.0.0 beta 3? or version 2.0 beta 3? Because I have been looking for hacks and I have like all for for 2.0.3 and i mean so many others have so many more. thanks

tubedogg
Sun 26th Aug '01, 12:29pm
2.0.3 == 2.0.3

This hack was released at the time of 2.0 beta 3 which was...erm...8? versions ago.

However it works fine with v2.0.3.

LuBi
Sun 26th Aug '01, 12:31pm
lol thanks, well I never knew that. do all 2.0 beta 3 hacks work with 2.0.3 by any chance?

Tweak
Tue 28th Aug '01, 12:17am
hmm i hope there will be one for VBB 2.0.1 or .3 Anyone here anything?

I tryed to add this hack to 2.0.3 but could find alot of the Code to replace.

tubedogg
Tue 28th Aug '01, 12:23am
There's no code to replace with this one...

Tweak
Tue 28th Aug '01, 12:54am
Oppps sorry tubedogg let me reword that... I tryed to install the code.. but couldnt find where to add the New code..

I would look fo a Line and it wouldnt show up.. so i didnt know where to add it.

Sorry man

tubedogg
Tue 28th Aug '01, 12:59am
That's what I meant too - there's no code to add/replace/remove/anything, just two variables to set in the script itself and add a link to it from somewhere.

Tweak
Tue 28th Aug '01, 1:43am
:p :D

BBInsider
Tue 28th Aug '01, 3:50pm
Very new to this, you guys talk over my head, lol.
Would anyone be willing to give it a try on my board?
http://www.buffalobillsinsider.com/graffitiboard/index.php3

BilzD@aol.com
Thanks all!
:)

Ruth
Wed 29th Aug '01, 3:49pm
what is the difference between this hack and the current active users in 2.0.3?

jcroft
Wed 29th Aug '01, 5:42pm
Has anyone modified this hack for use in a sidebar...with like a vertical list of the online users, with links to their profiles? If so, would you mind sharing your code? :D

Thanks,
Jeff Croft
forums.newbeetle.org

Bytes
Wed 29th Aug '01, 9:31pm
Just installed your online.php. Works like a charm!!!!!!!! ;)

Thanks!

Mike Gaidin
Wed 29th Aug '01, 10:00pm
Yes, I'm looking for a sidebar version as well. :)

Robouk
Wed 5th Sep '01, 11:09am
ok what happns if the path to your admin is on another server?
so you want to include who's online from your forum which is hosted elsewhere to your homepage, you see?

Robouk
Wed 5th Sep '01, 11:13am
its ok, i just insatlled the hack ontio the forums server and use php includes to include it onto my homepage, thanks!

Oliver
Fri 7th Sep '01, 1:12pm
how`d u do that robouk <sp> exactly?

please tell cause our board is on a completly different host, and i want online users on our main website.

i tried diferent variations, but to no avail.

what should the ssi call be?
where do i upload online.php, which server?

cheers
oli

Robouk
Fri 7th Sep '01, 6:44pm
upload online.php to the forums server and make it all work ok, then on you other website, use PHP INCLUDES to include it into your website...
you can see my version here:
http://robouk.gdesign.nl/v3/page.php

Oliver
Sat 8th Sep '01, 7:49am
Can SSI calls include files from another server,

<--!include file="http://anotherhost.com/online.php"-->

OR

<--!include virtual="http://anotherhost.com/online.php"-->

the page i want online members to be on is *.shtml on a different server.

Help anyone?

oli

Robouk
Sat 8th Sep '01, 9:22am
As far as i know SSI can only be used with files on the same server, but Includes can include files from anywhere..

James Cridland
Sat 8th Sep '01, 11:24am
Originally posted by jcroft
Has anyone modified this hack for use in a sidebar...with like a vertical list of the online users, with links to their profiles? If so, would you mind sharing your code? :D

Not running this - yet, at any rate. But looking at the code...

FIND
$regmemberson .= ", ";
REPLACE WITH
$regmemberson .= "<br>";

FIND
echo("Member(s) on: $regmemberson. Guest(s) on: $guestson.");
REPLACE WITH
echo("Member(s) on:<BR>$regmemberson.<BR>Guest(s) on:<BR>$guestson.");

My understanding of the code is that this should produce:

Member(s) on:
Hammer
Friend
JDoe
JBloggs.
Guest(s) on:
8.

Should be easy to program that as a configuration option; I'd fix "Member(s)" to work properly too, to be honest... not a difficult thing.

J

Oliver
Sun 9th Sep '01, 7:07pm
i tried that and it worked, you can even put the info into a table

Is there anyway to turn the name to a hyperlink to that users last post?

AND

have an alternate colour for each name, as if you place the code in a sidebar, 120 px wide, some names wrap?

oli

kamrad.ru
Mon 1st Oct '01, 1:12am
I have a problem:

Warning: Undefined variable: regmembercomma in d:\usr\www\online.php on line 59

Warning: Use of undefined constant invisible - assumed 'invisible' in d:\usr\www\online.php on line 60

Warning: Use of undefined constant username - assumed 'username' in d:\usr\www\online.php on line 61

Warning: Undefined variable: regmemberson in d:\usr\www\online.php on line 61

Warning: Use of undefined constant guestsonline - assumed 'guestsonline' in d:\usr\www\online.php on line 78
Member(s) on: Admin. Guest(s) on: 0.

YourHostSucks
Mon 1st Oct '01, 5:03am
Thats Not a problem, it should still owrk fine ;)
(hehe)

your site is at d:\usr\www\?
Just doesn't look right..

kamrad.ru
Mon 1st Oct '01, 6:20am
your site is at d:\usr\www\?
It`s localhost

kamrad.ru
Mon 1st Oct '01, 10:00am
Why then there are these mistakes
How to me to get rid of them?

Dez_U
Sat 13th Oct '01, 1:27pm
This may have been covered. But.

Can anyone tell me what to do to get the users on line on my forum at www.clanram.com/forum to show on my index page at www.clanram.com ??

I would like to do the same as http://www.finheaven.com

but I canny get the guy to answer me :)

Help much needed, thanks

Hooper
Sat 13th Oct '01, 10:51pm
anyone know if this still works with 2.03?

Thank You.

paulsjv
Thu 18th Oct '01, 11:37am
does anyone have the template that vBulletin uses for their currently online page? Cause I would love to use it if possible.

Thanks...

codyrush
Thu 25th Oct '01, 1:31am
There should be the ability to edit the HTML within the last echo string. I want to just bold the numbers, but not the words "Guests" or "Members"... any way to do this? Everytime I try editing the code in online.php, I get a Parse Error.

Talk to me.

Thanks,
Cody Rush