PDA

View Full Version : Online User Listing


10-25-2000, 02:18 PM
Right I have added the templates and created a file called: online.php

But when accessing it dosen't display any users! :(

http://vboard.co.uk/board/online.php?action=onlineusers

Here is whole of Online.php:

<?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 = "/board/";
} // 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 = "/board/";
} // 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 = "/board/";
} // 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 = "/board/";
} // 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 = "/board/";
} // 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 = "/board/";
} // 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 ###############################


Whats the problem?

Thanks

10-25-2000, 08:47 PM
It is crappy code! :) I'm not certain what is wrong -- you installed the templates and they have the correct names, right? Because it looks like it's not evaulating the bits correctly. Either that or everyone who is online has their user prefs set to invisible.

In any rate I've been slowly working on OnlineUsers 2.0 but I'm only halfway done. It should be better. Faster. More reliable. We have the technology! :)

10-25-2000, 08:53 PM
Hurry up and get it done as I have been contemplating doing it!

10-25-2000, 09:02 PM
the one I used works fine
http://www.clubbers.ws/vb/index.php
just click the Who's Online link

do you want me to post the file?

10-25-2000, 09:29 PM
It would be nice if we could make a modular system that would store the "String to display" in the session table so all future addons would automatically show up on the whos online, what are they doing page.

10-25-2000, 10:18 PM
Originally posted by ukliam
the one I used works fine
http://www.clubbers.ws/vb/index.php
just click the Who's Online link

do you want me to post the file?

yeah that would help! :)

10-25-2000, 10:19 PM
Originally posted by mrogish
It is crappy code! :) I'm not certain what is wrong -- you installed the templates and they have the correct names, right? Because it looks like it's not evaulating the bits correctly. Either that or everyone who is online has their user prefs set to invisible.

In any rate I've been slowly working on OnlineUsers 2.0 but I'm only halfway done. It should be better. Faster. More reliable. We have the technology! :)

No users are invisble!

I made two templates filled them in with the code as: whoisonline and whoisonlinebit

10-25-2000, 10:28 PM
Originally posted by ukliam
the one I used works fine
http://www.clubbers.ws/vb/index.php
just click the Who's Online link

do you want me to post the file?

???????? Doesn't work.

10-25-2000, 10:31 PM
Originally posted by Shane
Originally posted by ukliam
the one I used works fine
http://www.clubbers.ws/vb/index.php
just click the Who's Online link

do you want me to post the file?

???????? Doesn't work.


same here!

10-25-2000, 11:23 PM
Works for me, what problem are you getting?
perhaps it is a problem with guests viewing it

10-25-2000, 11:26 PM
yep, I cleared all cookies and now it does not work for me.
Seems it only works for members... sorry

10-26-2000, 04:40 AM
Originally posted by rangersfan
It would be nice if we could make a modular system that would store the "String to display" in the session table so all future addons would automatically show up on the whos online, what are they doing page.

Wouldn't sticking a line of code similar to this:
header("Location: index.php?categoryid=$categoryid");

At the beginning of each hack do the trick?

10-26-2000, 10:53 AM
so have I done everything ok?

10-26-2000, 10:54 AM
Just a recap:

I added two templates called whoisonline, whoisonlinebit and filled them in with the code that was suppose to use.

Then I made a file called: online.php which is filled up with that code in my fisr post in this thread.

10-26-2000, 05:23 PM
Could someone create a version of this hack that works properly and shows where guests are?

I would be ever-so grateful :)

I am sure others would also use it,
Thanks

Sean

10-26-2000, 11:28 PM
The code from the original thread on this worked just fine for me - I need to pretty it up a little, but its functional

I know that the orignal author is extremely busy with another project that he is working on

10-26-2000, 11:33 PM
I dont get whats wrong with it. :(

10-26-2000, 11:42 PM
Originally posted by rangersfan
It would be nice if we could make a modular system that would store the "String to display" in the session table so all future addons would automatically show up on the whos online, what are they doing page.

How did you guess? :)

10-26-2000, 11:44 PM
Originally posted by Zecherieh
The code from the original thread on this worked just fine for me - I need to pretty it up a little, but its functional

I know that the orignal author is extremely busy with another project that he is working on

Yep, almost done though! And BTW, did you get my reply to your e-mail you sent me a couple of weeks ago? It bounced back the first time saying "Tuffsports.com" was down or not accepting the message!!

10-26-2000, 11:50 PM
I'll try again once this new version of the online listings comes out.

Did you say friday? [tomorrow]

10-27-2000, 02:30 AM
Originally posted by mrogish
It is crappy code! :) I'm not certain what is wrong -- you installed the templates and they have the correct names, right? Because it looks like it's not evaulating the bits correctly. Either that or everyone who is online has their user prefs set to invisible.

In any rate I've been slowly working on OnlineUsers 2.0 but I'm only halfway done. It should be better. Faster. More reliable. We have the technology! :) hey matt, so how's the new back-end for your vBs doing ? ;)

can't wait to see who's online v2 :D

10-27-2000, 11:12 AM
YES I finally got it working.

http://vboard.co.uk/board/online.php?action=onlineusers

I named both templates whoisonline (d`oh)
Anyway I hope to see the new version soon. :)

12-06-2000, 02:58 AM
what did you put in those templates?