Log in

View Full Version : Who's online locations to non-forum pages..


Velocd
07-18-2002, 09:25 PM
I know how to add who's online locations to any page within the forum directory, but I would also like to add them to my main homepage index.php and other non-forum pages.

In online.php, at here:

case 'http://www.mysite.com/multimedia.php':
$userinfo[activity] = 'multimedia';
break;


This code doesn't work, because the case only takes filenames without the added URL prefix.

In example, it will work with this:

case 'multimedia.php':
$userinfo[activity] = 'multimedia';
break;


But is referring to the non-existant forums/multimedia.php file.

So how might I be able to fix this?

Admin
07-19-2002, 06:11 AM
You need to check $loc, and not $filename, which means you need to put the first bit of code outside (and AFTER) the switch statement.

if ($loc == 'http://www.mysite.com/multimedia.php') {
$userinfo['activity'] = 'multimedia';
}

Velocd
07-19-2002, 05:40 PM
I'm still receiving errors, which must mean I'm putting that bit of code you posted above in the wrong spot..

Here is the area in online.php I placed it:

default:
$userinfo[activity] = 'unknown';
}

if ($loc == 'http://www.mysite.com/multimedia.php') {
$userinfo['activity'] = 'multimedia';
}


Yet in my who's online, it is still saying unknown location. :(

Velocd
07-19-2002, 07:45 PM
b u m p
u
m
p

Neo
07-19-2002, 07:51 PM
Now how would it pick up where they are if on the other page you do not have anything connecting it to the site? so you might need to put some code in the scripts that are non-forum.

Velocd
07-19-2002, 11:38 PM
Oh, lol, forgot to mention. I'm running my homepage on VBhome lite, and also I've integrated just about the rest of my site with vbulletin, so everypage is referencing to global.php. So all I need now is to figure out what Firefly suggested..

Velocd
07-20-2002, 02:50 AM
*cough*
*cough*

Brad
07-20-2002, 09:59 AM
the way i did this with vBindex, was to rename the vBulletins index.php to forum.php. then i edited the index.php call in online.php to say "site home", made a new call for forum.php to say "forum index".

both the forum and site now run out of the same directory. just edit the templates with links to index.php to forum.php and you sould get the effect you want. a little extra work i know but a bit easyer on me in the end.

Velocd
07-23-2002, 03:53 AM
*on verge of death* Firefly...need..more..of..your..help on..post #3 :dead:

Velocd
07-23-2002, 11:05 PM
Firefly in post#2 are you saying to put this code:

if ($loc == 'http://www.mysite.com/multimedia.php') {
$userinfo['activity'] = 'multimedia';
}


After the second switch statements, and before the default case, as shown in post #3? Or are you referring to another piece of code? If there was just a simple way to point $loc to 'http://www.mysite.com/' and not the forum directory, I could just add 'forums/' at the start of all the cases.

ie:

case 'forums/showthread.php':
$userinfo[activity] = showthread;
break;

Admin
07-24-2002, 07:07 AM
You need to add it AFTER the switch, not INSIDE.

Velocd
07-24-2002, 05:19 PM
:confused: =falls over=

I have been putting the code outside of the switch statement.. The switch ends right after the default and bracket, right?


case 'printthread.php':
$userinfo[activity] = 'printthread';
$blowup = explode('=', $token1);
$threadid = intval($blowup[1]);
$threadids .= ",$threadid";
$userinfo[threadid] = $threadid;
break;
case 'chat.php':
$userinfo[activity] = 'chat';
break;
case 'gallery.php':
$userinfo[activity] = 'gallery';
break;
case '/robots.txt':
$userinfo[activity] = 'spider';
break;
default:
$userinfo[activity] = 'unknown';
} <-- switch ends here right?

[MY CODE goes here]

return $userinfo;
}

$allusers= $DB_site->query("SELECT user.username, session.location, session.lastactivity, user.userid, user.usergroupid, user.invisible, session.host, user.showemail, user.receivepm
FROM session
". iif($WOLguests, " LEFT JOIN user USING (userid) ", ",user") ."
WHERE session.lastactivity > $datecut
". iif(!$WOLguests, " AND session.userid = user.userid", "") ."
ORDER BY user.username
");

$moderators = $DB_site->query("SELECT DISTINCT userid FROM moderator");
while ($mods = $DB_site->fetch_array($moderators)) {
$mod[$mods[userid]] = 1;
}


And in the area where it says [MY CODE goes here], I placed this:

if ($loc == 'http://www.mysite.com/multimedia.php') {
$userinfo['activity'] = 'multimedia';
}


Changed to my URL ofcourse.

Which is outside and after the switch statement.. So I'm a bit lost :disappointed:

Admin
07-24-2002, 05:26 PM
Try this:
if (strstr($loc, 'http://www.mysite.com/multimedia.php')) {
$userinfo['activity'] = 'multimedia';
}

Velocd
07-24-2002, 06:18 PM
Still no go :(
Very strange indeed.

yetdog11
08-01-2002, 02:55 PM
I too would like to know the answer to this. However, we already have a custom php file included in all of our pages to include the vB membership, instead of just including global.php. So users are logged in outside of the board, basically. I assume that this means I don't have to include global.php, correct?

And then just go ahead and post the code in online.php as stated above?

Matthew Yette
matt@antsmarching.org

Velocd
08-23-2002, 11:04 PM
I'm going to bump this, but just one last time. This is still an unsolved problem I can't figure out.

NTLDR
08-23-2002, 11:31 PM
Have you tried including global.php in the file?

chdir('./path-to-global-php');
require('./global.php');

and then modifying online.php as per any other file in the forums directory?

Velocd
08-24-2002, 03:11 AM
Yup, everypage on my site is requiring global.php, mainly because I have integrated the entire site ;)

The problem is not with locations within my forums directory, it's with those outside of the directory, such as www.mysite.com/multimedia.php

Adding this in a regular fashion to online.php does not work, as discussed on the first page of this thread.

NTLDR
08-24-2002, 07:43 PM
Strange, that method works fine for me.

tkeil69575
10-24-2002, 01:47 PM
Hi,
NTLDR is right, it worked for me anyways.

I managed to integrate files in a new directory, which was also outside the forum location.

Just include the global in the external files and then add the locations as usual in the online.php

Chris M
10-24-2002, 01:54 PM
Hmmm...

Why dont you get the "Who's Online Admin Locations" hack, and add a new location:

Filename: ../mulitmedia.php
Description: Viewing the <a href="../multimedia.php?s=">Multimedia</a> page

Satan

NTLDR
10-24-2002, 02:05 PM
Originally posted by hellsatan
Why dont you get the "Who's Online Admin Locations" hack, and add a new location:

You can't put the path in or variables that are in the URL, like forumid=1 it will just ignore them, you need to do that manually.

Chris M
10-24-2002, 02:14 PM
I see...

Satan