![]() |
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: Code:
<? include("online.php"); ?> Secondly, by an SSI include: Code:
<!--#include file="online.php"--> 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! |
your the man dude
this is pop and just what i was looking for :) |
hey thanx ure gr8! now time for bdays to work :)
|
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! |
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.
|
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? |
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. |
Nice job tubedogg. I implemented this hack on to my homepage and will be updating it to the new release from yesterday. Thanks.
|
Wiil update it on
www.ishparentsboards.com :) |
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?
|
I seem to be getting "oops1"... what is that, and how do I fix it?
|
It can't complete the first query for some reason.
Try replacing Code:
$db=mysql_connect($servername,$dbusername,$dbpassword); Code:
$db=mysql_connect($servername,$dbusername,$dbpassword) or die("can't connect"); |
Yes.. I'm still getting the same error message.. "oops1".
|
I'm also not running on VB 2.. but, it should work, shouldn't it?
|
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.
|
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"; |
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? |
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 |
feedback:
The script is showing 8 members and 2 guests online while forums is showing currently 3 members and 2 guests on the boards. |
Great hack! I have the same problem as Byron. It is because of the cookies. Not sure if anything can be done about that.
|
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."); ?> |
Joshs,
Are you using WinNT/2k and IIS? |
Yes!
|
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. |
Oh s***! I was planning on integrating some of this stuff with my site!!!! So there is no way to get this working?!
|
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. :( |
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) |
nevermind
nice hack :) |
Quote:
Thanks in advance! Cygnus |
bump.
Tubedogg? You out there? Anyone else? Cygnus |
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 |
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. |
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???
|
Quote:
Cygnus |
Cygnus,
What you are describing is a bug in 2.0.3 itself. A fix is in the bugs forum. Amy |
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 |
Quote:
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 |
OK... tried that one... no luck. I switched it back.
I also tried this one... http://vbulletin.com/forum/showthrea...threadid=25521 Still no luck. Any chance you could tell me which bug? :) Thanks, Cygnus |
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? |
This hack never showed where people are and in fact it works perfectly for me on 2.0.3...
|
All times are GMT. The time now is 05:02 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|