PDA

View Full Version : It would be great if i could add where the user is at his info



Scaramanga_gold
Sat 30th Dec '00, 8:37am
Like the onlineusers listing hack works.

John Harrison
Sat 30th Dec '00, 10:13am
The online user listing hack was never released and was just a test.

The creater promised a second version (huh what happened with releasing the first version?) back in October and said it will be out sometime but we hear nothing from him.

I abandon the hack after it wouldn't display guests right and the fact that no one is going to release it.

I am trying to see if I can make this hack better but I dont think I can because I am not that high on PHP.

John Harrison
Sat 30th Dec '00, 10:13am
Also this should be in the code hacking forum!

Scaramanga_gold
Sat 30th Dec '00, 2:51pm
this is more template work than Php work. I have the hack installed and it works perfectly.

John Harrison
Sat 30th Dec '00, 2:55pm
oh sorry I misunderstood! :(

John Harrison
Sat 30th Dec '00, 2:57pm
Have you managed to get the guests showing as:

Guest: Forum Front
Guest02: vBcode
Guest03: Smiles
Guest04: Private Messager
.etc

?

Thanks In Advance :)

Scaramanga_gold
Sat 30th Dec '00, 3:20pm
Guest num 2 & 3 will get unknown location but the other guests you said will be seen correctly.

John Harrison
Sat 30th Dec '00, 4:37pm
On mine I dont get that.
I just dont get them named as Guest2, Guest3.etc

Empthy columns in the name row for anymore guests then 1 as the first guest is named guest.

Scaramanga_gold
Sun 31st Dec '00, 9:08am
On mine all the guests are called "guest" instead of "guest1,2,3..." but I dont mind, I can live with that.

John Harrison
Sun 31st Dec '00, 9:28am
Can you post the whole code of your online.php file here please?

I been looking for this in a long time. :)

Scaramanga_gold
Sun 31st Dec '00, 9:47am
no prob here it is:
Whoisonline.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;
// Orginal:
// $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" );
// New:
$onlineNow = $DB_site->query( "
SELECT s.userid,
u.username,
s.location
FROM session s
LEFT OUTER JOIN user u
ON u.userid = s.userid
WHERE u.invisible = 0 OR
u.invisible IS NULL
ORDER BY u.username ASC" );




if( $online = $DB_site->fetch_array( $onlineNow ) ) {

$numVisible++;
$userid = $online[ userid ];
// old: $username = $online[ username ];
// new:
if( $online[ username ] != "" ) {
$username = $online[ username ];
} else {
$username = "Guest";
} // end if
$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 = "/~darkngel/";
} // 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 = "/~darkngel/";
} // 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 = "/~darkngel/";
} // 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 ];
if( $online[ username ] != "" ) {
$username = $online[ username ];
} else {
$username = "Guest";
} // end if

$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 = "/~darkngel/";
} // 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 = "/~darkngel/";
} // 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 = "/~darkngel/";
} // 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 ###############################

John Harrison
Sun 31st Dec '00, 10:27am
Thanks :)

Dark007
Fri 12th Jan '01, 7:51pm
Cool one,

BTW where can i download this hack ? Or implement the version you have pasted right here....

Thank You,

Dark007

(Feels like bond in the dark, shaken not stirred) :D