PDA

View Full Version : Who's Online In Admin CP


NTLDR
08-31-2002, 10:00 PM
Who's Online In Admin CP
Version 1.0

This thread (https://vborg.vbsupport.ru/showthread.php?threadid=43018) inspired and reminded me that I wanted to make the who's online page avalible in the Admin CP.

This hack display's a table at the top of the home page in the Admin CP, see screenshot in the next post :D

I will be adding in the IP and hopefully the locations in the next version ;)

File Edits: 1

If you use this hack please click install :D

NTLDR
09-01-2002, 09:54 PM
Screenshot :D

Attrox
09-01-2002, 09:54 PM
Can you please post a screenshot?

*EDIT*
Nevermind, you beat me to it. ;)

N9ne
09-01-2002, 10:35 PM
Question: Does it show who's online in the adminCP, or does it show who's online on the forum and/or adminCP in the adminCP?

If it shows who's online on the whole forum aswell, it'd be a bit long for my forum :(

NTLDR
09-01-2002, 10:37 PM
It's a slimline version of what you get on online.php ;)

Mike Gaidin
09-02-2002, 01:21 AM
Looks good. That's EXACTLY what I was looking for. You did a great job. Thanks to joecool too for helping me earlier. Great job!

Mike Gaidin
09-02-2002, 01:32 AM
*EDIT* Fixed

g-force2k2
09-02-2002, 01:37 AM
J-OST could be different sessions... does it show the same exact time? regards...

NTLDR looking nice man :) just on a side not you could accomplish the same effect simply by creating linkage to the who's online file and call it straight from the forum ;) but either way good job :) regards...

g-force2k2

N9ne
09-02-2002, 03:13 AM
like an Iframe I guess

joecool
09-02-2002, 10:47 AM
Hey.. great improvement over my hack ;)

NTLDR
09-02-2002, 12:50 PM
Originally posted by joecool
Hey.. great improvement over my hack ;)

Thanks :) You post inspired me to do this like I have been meaning to do for months :D

NTLDR
09-02-2002, 01:00 PM
Originally posted by g-force2k2
just on a side not you could accomplish the same effect simply by creating linkage to the who's online file and call it straight from the forum ;)

True, I did think of that, but this way, helps increase my PHP knowlage as well as using the CP colours. Also that way would require lots of modifications to online.php to make the links correct and to remove the the requirement of global.php;)

Link14716
09-02-2002, 01:10 PM
I had some cosmetic issues to say the least, but fixed i by adding the code above doformheader("user","find"); instead of replacing that with the WOL code.

* Link14716 clicks install.

Tim Wheatley
09-04-2002, 07:38 PM
This is a slimline version of whos online? So does it just show whos in the admin cp or the whole forum + the admin cp... I'm not sure that was answered...?? :D

NTLDR
09-04-2002, 08:35 PM
It's a slimline version of the who's online page, but will also show who's in the Admin CP

Tim Wheatley
09-04-2002, 10:32 PM
Any change you could make a small mod for me?

So that this just shows who's in the cp when you're there.

Tony G
09-08-2002, 03:31 AM
Just installed, great work. :)

Bison
09-11-2002, 03:08 AM
I like that iframe view ... the thing I don't grab from this one is that it doesn't reveal the location of the user ... or am I forgetting to do something here!

This part of the code seems to be set to where you want people to show up in the location area:

if ($online[location] = " ") {
$online[location] = "Control Panel";
}
if ($online['usergroupid'] == 6) {
$username = "<b><i>$online[username]</i></b>";
} else if ($online['usergroupid'] == 5) {
$uusername = "<b>$user[username]</b></font>";
} else {
$username = $online[username];

I rather it tell me where they actually are, instead of a static "control panel" location entry. One other thing that noticed when I tested was that it repeated the user names (made duplicates) of users in the same window. I was only logged in once and it showed me and other users as being logged in twice!

Sorry, but it didn't workout for me.

NTLDR
09-11-2002, 05:35 PM
The static location Control Panel appears as there arn't any locations for users within the Admin CP, the DB entry for location when in the ACP is blank. Users appearing multiple times is due to multiple current sessions within the DB for the user, like after you have just logged into the ACP.

Dan Flynn
09-28-2002, 07:46 PM
I'm getting this in the admin. Doesn't seem right. I'm in there several time s and we're all located in the control panel. I checked mydomain/online.php and that seems to be working fine.

Maybe you answered this above not sure!

Ant help????

Thanks

Kars10
10-20-2002, 07:45 PM
Originally posted by Dan Flynn
I'm getting this in the admin. Doesn't seem right. I'm in there several time s and we're all located in the control panel. I checked mydomain/online.php and that seems to be working fine.

Maybe you answered this above not sure!

Ant help????

Thanks

...i get the same error! Any Idea? :cheeky:

NTLDR
10-20-2002, 07:48 PM
Each time you log into the ACP you are given a "fresh" session, so you get duplicate sessions in the DB which is why users in the CPs may appear more than once.

Kars10
10-20-2002, 07:49 PM
Thanx NTLDR! :)
* Minifreunde klicks install!

Sparkz
12-01-2002, 05:54 AM
Nice one.
Did a couple of minor changes to show the IP too.

Sparkz
12-01-2002, 05:54 AM
Nice one.
Did a couple of minor changes to show the IP too.

Talisman
12-01-2002, 01:52 PM
Originally posted by Sparkz
Did a couple of minor changes to show the IP too.

Hey, Sparkz, would you or your lobster tell us how to add the IP address? I'm not real good at this stuff, yet. Thanks.

Love this hack, but I've noticed a problem. Seems it's showing all user locations as being in the Control Panel, when that's not correct. (See attachment.)

At the time I took that shot, the top person was looking at our forum's main page and the next one shown was viewing something in our photo gallery. Neither of these members have access to the ACP.

Any suggestions how to fix this?

Oblivion Knight
12-06-2002, 02:05 PM
Seems to be working ok so far..
Nice hack, thanks NTLDR :)

Sparkz
12-06-2002, 03:30 PM
Originally posted by Talisman


Hey, Sparkz, would you or your lobster tell us how to add the IP address? I'm not real good at this stuff, yet. Thanks.


Sure, but both my lobster and I are out of town now, and I don't have an SSH client on this comp. I'll try to remember posting the changes I made when I get back home. It's just a couple of lines or so.

sreedchi
02-04-2003, 01:49 AM
I get all my users in the Control Panel too. I'm on VB 2.2.9 , PHP v4.2.2 and MySQL v3.23.41.

Did anyone figure this out?

sreedchi
02-05-2003, 11:10 AM
??

sreedchi
02-08-2003, 08:18 PM
Just to add... when a 'Guest' is online, it shows the actual thread/location. Anyone registered though, it just shows "Control Panel"

Red Blaze
02-11-2003, 06:50 PM
Out of all the hacks I've seen, I don't really like this one. Basically because

1) It doesn't show the actual location
2) I don't like the fact that the user is repeated 2 to 3 times.

Sorry guy. *shrugs* It may be good to others, but not me.

Good work though. At least others do like it. ;)

sreedchi
02-12-2003, 01:34 AM
If it showed the actual location, it would be great. I get the sense that it is intended to. It shows actual location for "guests."

Is there a better hack I should know about?

amykhar
03-16-2003, 06:49 PM
Bug Fix!


if ($online[location] = " ") {


Should be:


if ($online[location] == " ") {

vB-Host.com
05-14-2003, 12:31 PM
I also have admin stats installed and since installing your hack. It now gives me "Resources ID #24" instead of total online.. here is a screenshot

http://www.thesportsforum.net/adminscreen.gif

OmaniMan
05-21-2003, 10:26 PM
Great Hacks...
OmaniMan .. Install It

AllMadden.net
07-03-2003, 03:18 PM
I am also curious as to why it shows everyone in control panel rather than where they really are...

Till
08-04-2003, 08:58 AM
Works perfectly, way to go. :)

mccollin
08-22-2003, 07:12 PM
This is the solution to all your registered users being in the Control Panel... which is a bit alarming at first glance. ;)

The online location when you are in the Control Panel is null, not blank, so this solves it.


if ($online[location] = " ") {


if (!$online[location]) {


OK, now someone want to trade me and show how what you did to show the IP address?

By the way, NTLDR is the GREATEST! I am a person who likes simplicity, and your hacks make things that appear to be complex, end up being simple. Thanks for contributing your work!

mccollin
08-22-2003, 07:31 PM
OK, scratch my last trade comment... here is the code WITH the location fixed for registered users, and the IP address added...there are too many changes to list them, given the total size. I'm going to make a final edit that I won't upload, because it deviates from the spirit of the original code. If anyone wants it, let me know. I'm going to kill the IP column, and just replace "Guest" with their IP address. That will eliminate a column, and I don't care about IP addresses for registered users anyway. If anyone wants it, i'll post it.



$datecut = time()-$cookietimeout;

$onlineusers = mysql_query("SELECT DISTINCT username,location,session.lastactivity,session.hos t,usergroupid FROM user,session WHERE session.userid=user.userid AND session.lastactivity>$datecut ORDER BY username ASC");
echo "<br><br><table width=\"90%\" align=\"center\" border='0' cellpadding='0' cellspacing='0' class='tblborder'><tr><td>";
echo "<table width=\"100%\" border=0 cellspacing=1 cellpadding=4><tr class='tblhead'><td align=\"center\" colspan=4 width=\"100%\"><b><span class='tblhead'>Who's Online</span></b></td></tr>\n";
echo "<tr class='".getrowbg()."'><td nowrap align=\"center\"><font size='1'><b>Username</b></font></td><td align=\"center\" nowrap><font size='1'><b>Location</b></font></td><td align=\"center\" nowrap><font size='1'><b>Host IP</b></font></td><td align=\"center\" nowrap><font size='1'><b>Last Active</b></font></td></tr>\n";
while ($online=$DB_site->fetch_array($onlineusers)) {
if (!$online[location]) {
$online[location] = "Control Panel";
}
if ($online['usergroupid'] == 6) {
$username = "<b><i>$online[username]</i></b>";
} else if ($online['usergroupid'] == 5) {
$uusername = "<b>$user[username]</b></font>";
} else {
$username = $online[username];
}
$lastactivity=vbdate($timeformat,$online[lastactivity]);
echo "<tr class='".getrowbg()."'><td nowrap><a href=\"../member.php?s=$session[sessionhash]&action=getinfo&username=$online[username]\" target=_blank>$username</a></td><td nowrap>$online[location]</td><td nowrap>$online[host]</td><td nowrap>$lastactivity</td></tr>";
}
$onlineguests = mysql_query("SELECT DISTINCT location,lastactivity, host FROM session WHERE userid=0 AND session.lastactivity>$datecut ORDER BY host ASC");
while ($onlineg=$DB_site->fetch_array($onlineguests)) {
$lastguestactivity=vbdate($timeformat,$onlineg[lastactivity]);
echo "<tr class='".getrowbg()."'><td nowrap>Guest</td><td nowrap>$onlineg[location]</td><td nowrap>$onlineg[host]</td><td nowrap>$lastguestactivity</td></tr>";
}
echo "</table></td></tr></table>";

NTLDR
08-22-2003, 07:39 PM
Try this one, its totally untested as I don't use vBulletin 2 anymore, should show the IP address and includes the location fix :)

Just replace the code with whats in this text file, if anyone confirms it works then I'll update the first post.

*heh* I just looked bellow and it looks like mccollin has posted almost the same code :D

mccollin
08-22-2003, 08:06 PM
I said I wasn't going to post the other code, but this is cool... I replaced the "guest" with the ip address, and sorted by it. Each ip address is a hotlink to samspade.com to get the host info.


$datecut = time()-$cookietimeout;

$onlineusers = mysql_query("SELECT DISTINCT username,location,session.lastactivity,usergroupid FROM user,session WHERE session.userid=user.userid AND session.lastactivity>$datecut ORDER BY username ASC");
echo "<br><br><table width=\"90%\" align=\"center\" border='0' cellpadding='0' cellspacing='0' class='tblborder'><tr><td>";
echo "<table width=\"100%\" border=0 cellspacing=1 cellpadding=4><tr class='tblhead'><td align=\"center\" colspan=4 width=\"100%\"><b><span class='tblhead'>Who's Online</span></b></td></tr>\n";
echo "<tr class='".getrowbg()."'><td nowrap align=\"center\"><font size='1'><b>Username</b></font></td><td align=\"center\" nowrap><font size='1'><b>Location</b></font></td><td align=\"center\" nowrap><font size='1'><b>Last Active</b></font></td></tr>\n";
while ($online=$DB_site->fetch_array($onlineusers)) {
if (!$online[location]) {
$online[location] = "Control Panel";
}
if ($online['usergroupid'] == 6) {
$username = "<b><i>$online[username]</i></b>";
} else if ($online['usergroupid'] == 5) {
$uusername = "<b>$user[username]</b></font>";
} else {
$username = $online[username];
}
$lastactivity=vbdate($timeformat,$online[lastactivity]);
echo "<tr class='".getrowbg()."'><td nowrap><a href=\"../member.php?s=$session[sessionhash]&action=getinfo&username=$online[username]\" target=_blank>$username</a></td><td nowrap>$online[location]</td><td nowrap>$lastactivity</td></tr>";
}
$onlineguests = mysql_query("SELECT DISTINCT location,lastactivity, host FROM session WHERE userid=0 AND session.lastactivity>$datecut ORDER BY host ASC");
while ($onlineg=$DB_site->fetch_array($onlineguests)) {
$lastguestactivity=vbdate($timeformat,$onlineg[lastactivity]);
echo "<tr class='".getrowbg()."'><td nowrap><a href=\"http://www.samspade.org/t/ipwhois?a=$onlineg[host]\" target=_blank>$onlineg[host]</a></td><td nowrap>$onlineg[location]</td><td nowrap>$lastguestactivity</td></tr>";
}
echo "</table></td></tr></table>";

FWF
08-30-2003, 07:47 AM
this is very cool im going to use it.

manning
04-05-2007, 03:50 AM
Is something like this available for the latest version of vb?

manning
04-16-2007, 08:46 PM
nothing?