The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
![]() |
|||||||||||||||||||||||||
Here is the long awaited (yeah right
![]() and referenced in kevinho's post. Anyway, I stuck it in its own php file for ease of installing when vB updates are released. To Do List:
Known Bugs:
To install you need two things:
Create the aforementioned PHP file or feel free to open member.php and pick a nice place. Paste the following into your file of choice: Code:
Matt 8-29-00 Look at the code a few messages down!! /Matt 8-29-00 ![]() Create a template called whoisonline and fill it with: Code:
<HTML> <HEAD> <title>$bbtitle - Online Now!</title> </HEAD> <body bgcolor="#ffffff" text="#000000" id=all> <table border="0" width="100%"><tr> <td valign="top" align="left"></td> <td valign="middle" align="center" nowrap> </td></tr></table> <a href="javascript:location.reload( )"><FONT SIZE="2" FACE="arial, helvetica">Refresh</font></a> <table border=0 cellpadding=4 border=0 cellspacing=1 width=100%> <tr bgcolor="#113274"><TD COLSPAN=2> <table width="100%" border=0 cellpadding=0 cellspacing=0> <tr><td align="left" valign="middle"> <FONT SIZE="2" FACE="arial, helvetica" color="#FFFFFF"><B>Online Users</B></font></td> <td align="right" valign="middle"> <FONT SIZE="2" FACE="arial, helvetica" color="#FFFFFF"><B>Location</B></font></td> </td></tr></table> </td></tr> $whoisonlinebits </table> Code:
<tr><td bgcolor="#C3C3EB"><FONT SIZE="2" FACE="arial, helvetica"><a href="member.php?action=getinfo&userid=$userid">$username</a> <a href="private.php?action=newmessage&toid=$userid" target="_blank"><img src="images/pm1.gif" border=0></img></a></font></td> <td bgcolor="#AAAAE6"><FONT SIZE="2" FACE="arial, helvetica"><a href="$locationLink" target="_blank">$location</a></font></td> </tr> NOTE: If you do not have private messaging installed (why not???!?!) then remove this line: Code:
<a href="private.php?action=newmessage&toid=$userid" target="_blank"><img src="images/pm1.gif" border=0></img></a> I would appreciate help on cleaning / optimizing the code and any URLs that I forgot cases for. Thanks!! -- Matt [Edited by mrogish on 08-29-2000 at 10:32 PM] Show Your Support
|
Comments |
#2
|
|||
|
|||
![]()
Cool, I was waiting for someone to release this
http://216.10.26.98/vb/index.php - click the Whos online link. Nice job, is there any chance of getting it to show where the guests are browsing? I changed a bit of the html, it uses the meta refresh instead of the java method, and I changed some of the layout and set it to use the variables instead of having fixed fonts and colours etc. |
#3
|
|||
|
|||
![]()
ukliam,
Thanks for the kind words, I'll try to keep making improvements as I get more free time! If you want to show all users remove 'WHERE s.userid <> 0' from the SELECT statement. That *should* display everything in the table. However, the code will be slightly goofed as there is no profile for USERID=0 (a guest), so if anyone clicks on the username vB should display an error (no userid or somesuch). |
#4
|
|||
|
|||
![]()
WOW Cool! Just found this hack. I liek the way it tells exactly what the user is doing, like viewing the homepage, posting a new thread, etc. Good Job!
I am adding this to my homepage now (one of few hacks that I will actually install because it doesnt require modification of the main script(s) ) Thanks again ~Chris |
#5
|
|||
|
|||
![]()
Thanks TechTalk,
I intentionally made it a separate .php file for the very reason that if it's not adopted into the final release ![]() Actually, I've updated it a lot to fix miscellaneous bugs that I've found (the largest one being the fact that non-moderators can view the topics of moderator-only threads -- this can be a security breach if you have important topics inside (such as "What to do with user XXX??"). Known bugs: Logged out user (member.php?action=clearcookies) Example: http://www.baseballboards.com/boards...on=onlineusers Here is whoisonline.php: Code:
<?PHP require( "global.php" ); // ############################### start online users form ############################### // ##### // ##### Online Users Modification // ##### // ##### Matt Rogish // ##### 7/5/00 // ##### // ##### Updated 8/29/00 if( $action == "onlineusers" ) { $loggedins = $DB_site->query_first( "SELECT COUNT(sessionid) AS sessions FROM session" ); $totalonline = $loggedins[ sessions ]; $loggedins = $DB_site->query_first( "SELECT COUNT(sessionid) AS sessions FROM session WHERE userid = 0" ); $numberguest = $loggedins[ sessions ]; $loggedins = $DB_site->query_first( "SELECT COUNT(sessionid) AS sessions FROM session WHERE userid <> 0" ); $numberregistered = $loggedins[ sessions ]; $numVisible = 0; $onlineNow = $DB_site->query( "SELECT s.userid, u.username, s.location FROM session s LEFT JOIN user u ON u.userid = s.userid WHERE s.userid <> 0 AND u.invisible = 0 ORDER BY u.username ASC" ); if( $online = $DB_site->fetch_array( $onlineNow ) ) { $numVisible++; $userid = $online[ userid ]; $username = $online[ username ]; $location = $online[ location ]; // Save our hyperlink $locationLink = $location; // Give us the .php file and path $phpFile = strtok( $location, "?" ); // Give us the extra threadid=47565&pagenumber=2 $queryString = strtok( "?" ); if( empty( $queryString ) ) { if( strpos( $location, "chat" ) ) { $location = "$bbtitle Chat"; } else { $location = "$bbtitle Main"; } // end if } else { // Give us the query (threadID, forumID, etc.) $query = strtok( $queryString, "=" ); if( strcasecmp( $query, "action" ) == 0 ) { // Then we are either newreply or getinfo, etc. $query = strtok( "&" ); // Preserve the "newreply" or "editpost" $mainQuery = $query; // Get the "other" thing $query = strtok( "=" ); } // end if // Give us the number (potentially followed by other things) $oldID = strtok( "=" ); // Clear out the ID $id = ""; if( eregi( "[0-9]+", $oldID, $cleanIDArray ) ) { for( $i = 0; $i <= count( $cleanIDArray ); $i++ ) { $id .= $cleanIDArray[ $i ]; } // end for } else { // Nothing, so probably the main page $location = "$bbtitle Main"; } // end if if( empty( $id ) ) { $id = 0; } // end if if( strcasecmp( $query, "threadid" ) == 0 ){ $threadTitle = $DB_site->query_first( "SELECT title, forumid FROM thread WHERE threadid=$id" ); $location = $threadTitle[ title ]; $forumid = $threadTitle[ forumid ]; $forumid = verifyid( "forum", $forumid ); $getperms = getpermissions( $bbuserid, $bbusergroupid, $forumid ); if( $getperms[ canview ] == 0 ) { $location = "Moderators Only Thread"; $locationLink = "/boards/"; } // end if } else if( strcasecmp( $query, "forumid" ) == 0 and strcasecmp( $mainQuery, "newthread" ) != 0 ) { $forumTitle = $DB_site->query_first( "SELECT title FROM forum WHERE forumid=$id" ); $location = $forumTitle[ title ]; } else if( strcasecmp( $query, "postid" ) == 0 and strcasecmp( $mainQuery, "editpost" ) != 0 ){ $getthreadid = $DB_site->query_first( "SELECT threadid FROM post WHERE postid=$id" ); $threadid = $getthreadid[ threadid ]; if( !empty( $threadid ) ) { $threadTitle = $DB_site->query_first( "SELECT title, forumid FROM thread WHERE threadid=$threadid" ); $location = $threadTitle[ title ]; $forumid = $threadTitle[ forumid ]; $forumid = verifyid( "forum", $forumid ); $getperms = getpermissions( $bbuserid, $bbusergroupid, $forumid ); if( $getperms[ canview ] == 0 ) { $location = "Moderators Only Thread"; $locationLink = "/boards/"; } // end if } else { $location = "Unknown location!"; } // end if } else if( strcasecmp( $mainQuery, "getinfo" ) == 0 ) { $userResult = $DB_site->query_first( "SELECT username FROM user WHERE userid=$id" ); $userName = $userResult[ username ]; $location = "Get User Information For: $userName"; } else if( strcasecmp( $mainQuery, "newthread" ) == 0 ) { $forumTitle = $DB_site->query_first( "SELECT title FROM forum WHERE forumid=$id" ); $forum = $forumTitle[ title ]; $location = "Creating new thread in $forum"; } else if( strpos( $phpFile, "private.php" ) ) { $location = "Private Messaging"; } else if( strpos( $phpFile, "search.php" ) ) { $location = "Searching"; } else if( strpos( $phpFile, "memberlist.php" ) ) { $location = "Member Listing"; } else if( strcasecmp( $mainQuery, "editpost" ) == 0 ) { $getthread = $DB_site->query_first( "SELECT threadid FROM post WHERE postid=$id" ); $threadid = $getthread[ threadid ]; if( !empty( $threadid ) ) { $threadTitle = $DB_site->query_first( "SELECT title, forumid FROM thread WHERE threadid=$threadid" ); $thread = $threadTitle[ title ]; $forumid = $threadTitle[ forumid ]; $forumid = verifyid( "forum", $forumid ); $getperms = getpermissions( $bbuserid, $bbusergroupid, $forumid ); if( $getperms[ canview ] == 0 ) { $thread = "Moderators Only Thread"; $locationLink = "/boards/"; } // end if } else { $location = "Unknown location!"; } // end if $location = "Editing post in $thread"; } else if( strcasecmp( $mainQuery, "onlineusers" ) == 0 ) { $location = "Online Users Listing"; } else { $location = "Unknown location!"; } // end if } // end if eval("\$whoisonlinebits .= \"" . gettemplate("whoisonlinebit") . "\";"); while( $online = $DB_site->fetch_array( $onlineNow ) ) { $numVisible++; $userid = $online[ userid ]; $username = $online[ username ]; $location = $online[ location ]; // Save our hyperlink $locationLink = $location; // Give us the .php file and path $phpFile = strtok( $location, "?" ); // Give us the extra threadid=47565&pagenumber=2 $queryString = strtok( "?" ); if( empty( $queryString ) ) { if( strpos( $location, "chat" ) ) { $location = "$bbtitle Chat"; } else { $location = "$bbtitle Main"; } // end if } else { // Give us the query (threadID, forumID, etc.) $query = strtok( $queryString, "=" ); if( strcasecmp( $query, "action" ) == 0 ) { // Then we are either newreply or getinfo, etc. $query = strtok( "&" ); // Preserve the "newreply" or "editpost" $mainQuery = $query; // Get the "other" thing $query = strtok( "=" ); } // end if // Give us the number (potentially followed by other things) $oldID = strtok( "=" ); // Clear out the ID $id = ""; if( eregi( "[0-9]+", $oldID, $cleanIDArray ) ) { for( $i = 0; $i <= count( $cleanIDArray ); $i++ ) { $id .= $cleanIDArray[ $i ]; } // end for } else { // Nothing, so probably the main page $location = "$bbtitle Main"; } // end if if( empty( $id ) ) { $id = 0; } // end if if( strcasecmp( $query, "threadid" ) == 0 ){ $threadTitle = $DB_site->query_first( "SELECT title, forumid FROM thread WHERE threadid=$id" ); $location = $threadTitle[ title ]; $forumid = $threadTitle[ forumid ]; $forumid = verifyid( "forum", $forumid ); $getperms = getpermissions( $bbuserid, $bbusergroupid, $forumid ); if( $getperms[ canview ] == 0 ) { $location = "Moderators Only Thread"; $locationLink = "/boards/"; } // end if } else if( strcasecmp( $query, "forumid" ) == 0 and strcasecmp( $mainQuery, "newthread" ) != 0 ) { $forumTitle = $DB_site->query_first( "SELECT title FROM forum WHERE forumid=$id" ); $location = $forumTitle[ title ]; } else if( strcasecmp( $query, "postid" ) == 0 and strcasecmp( $mainQuery, "editpost" ) != 0 ) { $getthreadid = $DB_site->query_first( "SELECT threadid FROM post WHERE postid=$id" ); $threadid = $getthreadid[ threadid ]; if( !empty( $threadid ) ) { $threadTitle = $DB_site->query_first( "SELECT title, forumid FROM thread WHERE threadid=$threadid" ); $location = $threadTitle[ title ]; $forumid = $threadTitle[ forumid ]; $forumid = verifyid( "forum", $forumid ); $getperms = getpermissions( $bbuserid, $bbusergroupid, $forumid ); if( $getperms[ canview ] == 0 ) { $location = "Moderators Only Thread"; $locationLink = "/boards/"; } // end if } else { $location = "Unknown location!"; } // end if } else if( strcasecmp( $mainQuery, "getinfo" ) == 0 ) { $userResult = $DB_site->query_first( "SELECT username FROM user WHERE userid=$id" ); $userName = $userResult[ username ]; $location = "Getting user information for $userName"; } else if( strcasecmp( $mainQuery, "newthread" ) == 0 ) { $forumTitle = $DB_site->query_first( "SELECT title FROM forum WHERE forumid=$id" ); $forum = $forumTitle[ title ]; $location = "Creating new thread in $forum"; } else if( strpos( $phpFile, "private.php" ) ) { $location = "Private Messaging"; } else if( strpos( $phpFile, "search.php" ) ) { $location = "Searching"; } else if( strpos( $phpFile, "memberlist.php" ) ) { $location = "Member Listing"; } else if( strcasecmp( $mainQuery, "editpost" ) == 0 ) { $getthread = $DB_site->query_first( "SELECT threadid FROM post WHERE postid=$id" ); $threadid = $getthread[ threadid ]; if( !empty( $threadid ) ) { $threadTitle = $DB_site->query_first( "SELECT title, forumid FROM thread WHERE threadid=$threadid" ); $thread = $threadTitle[ title ]; $forumid = $threadTitle[ forumid ]; $forumid = verifyid( "forum", $forumid ); $getperms = getpermissions( $bbuserid, $bbusergroupid, $forumid ); if( $getperms[ canview ] == 0 ) { $thread = "Moderators Only Thread"; $locationLink = "/boards/"; } // end if } else { $location = "Unknown location!"; } // end if $location = "Editing post in $thread"; } else if( strcasecmp( $mainQuery, "onlineusers" ) == 0 ) { $location = "Online Users Listing"; } else { $location = "Unknown location!"; } // end if } // end if eval( "\$whoisonlinebits .= \"" . gettemplate( "whoisonlinebit" ) . "\";" ); } // end while eval( "echo dovars(\"" . gettemplate( "whoisonline" ) . "\");" ); } // end if } // end if // ##### // ##### Online Users Modification // ##### // ##### Matt Rogish // ##### 7/5/00 // ##### // ##### Updated 8/29/00 // ############################### end online users form ############################### |
#6
|
|||
|
|||
![]()
P.S.
If you are using it, you'll notice that forums the user doesn't have permission to see will show up as "mods only". Well, the $locationlink points to "/boards" since the directory structure we have is: http://www.baseballboards.com/boards/ <-PHP files live here (aka "forums"). So, if your index.php resides in a different dir, replace $locationLink = "/boards/"; with $locationLink = "/SOME/PATH/"; |
#7
|
|||
|
|||
![]()
woah... alot of code
![]() gonna try this out... |
#8
|
|||
|
|||
![]()
eva2000:
Yep, it is fairly inefficent right now. This will probably change later, but right now I'm too busy with other boards 'stuff' to worry about it. ![]() However, v2 of whoisonline.php will not be as inefficent, slow, etc. This was my first crack at it and it *works*, just not too quickly depending on the number of users / posts. |
#9
|
|||
|
|||
![]()
OK got it working here:
http://www.extremeforums.com/forums/onlineusers.php I did change one thing: I got rid of the first "if" statement so I didnt have to add the "?action=onlineusers" to the end of the url. One thing i noticed: if the user is on: http://www.extremeforums.com/forums/onlineusers.php Then it says they are on "Extreme Forums Main".... Any fix for this? Thanks ~Chris |
#10
|
|||
|
|||
![]()
Chris,
Yep, that is because I (for some unknown reason now) have it checking the second half of the URL to see what the user is doing.. so in effect it looks at the ?action=WHATEVER and if it sees "onlineusers" it will display "Online users listing". When you removed that, that functionality ceased to exist. However, if you want it to work, here's how to "fix" ![]() Change: Code:
} else if( strcasecmp( $mainQuery, "onlineusers" ) == 0 ) { ![]() To: Code:
} else if( strpos( $phpFile, "onlineusers.php" ) ) { Ok, I realize that could be done with $PHP_SELF, but for the time being do it my crappy way. ![]() |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|