PDA

View Full Version : Track 1 user


Zzed
04-06-2002, 10:00 PM
This hack allows you to track a single user with frequent updates set at 5
second intervals. This hack was originally requested by Riddel.

The hack is based on online.php. The way to call it is by passing it the
userid of the member you wish to track.

Like this: online.php?userid=####

Where #### is the userid of the member to track:

Example: online.php?userid=1 (If you want to track the site admin) :)

In online.php:

Look for the following code:

$allusers= $DB_site->query("SELECT user.username, session.location, session.lastactivity, user.userid, user.usergroupid, user.invisible, sessi\
on.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 replace it with the following:

if($userid)
{
unset($WOLrefresh);
$metarefresh = "<META HTTP-EQUIV=\"refresh\" CONTENT=\"5; URL=online.php?userid=$userid\"> ";

$allusers= $DB_site->query("SELECT user.username, session.location, session.lastactivity, user.userid, user.usergroupid, user.invisible, sessi\
on.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", "") ."
AND user.userid = $userid
ORDER BY user.username
");
}
else{
$allusers= $DB_site->query("SELECT user.username, session.location, session.lastactivity, user.userid, user.usergroupid, user.invisible, sessi\
on.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;
}
}

Velocd
04-07-2002, 07:04 PM
Screenshots or anything if available? I can't see the purpose of this..why track a single user when Who's Online tracks all online users. :?

Zzed
04-07-2002, 07:54 PM
I had a typo in my original post. I was pointing to the wrong URL in my META tag. Sorry. :(

Velocd, when you have too many users online, it becomes a little botersome to scroll down to a particular user and track them.

Here is a screenshot. I am tracking myself on my board.

JulianD
04-07-2002, 08:40 PM
Thanks Zzed. Very nice... I will not install it on my boards, since we don't have too much members online, but I am subscribing to the thread, I will probably need this in a future day.

Thanks for the great job

wolfman
03-13-2003, 02:10 AM
Well the code got slightly mangled when you posted


if($userid)
{
unset($WOLrefresh);
$metarefresh = "<META HTTP-EQUIV=\"refresh\" CONTENT=\"5; URL=online.php?userid=$userid\"> ";

$allusers= $DB_site->query("SELECT user.username, session.location, session.lastactivity, user.userid, user.usergroupid, user.invisible, sessi\
on.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", "") ."
AND user.userid = $userid
ORDER BY user.username
");
}
else{
$allusers= $DB_site->query("SELECT user.username, session.location, session.lastactivity, user.userid, user.usergroupid, user.invisible, sessi\
on.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;
}
}

It should have looked like this



if($userid)
{
unset($WOLrefresh);
$metarefresh = "<META HTTP-EQUIV=\"refresh\" CONTENT=\"5; URL=online.php?userid=$userid\"> ";

$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", "") ."
AND user.userid = $userid
ORDER BY user.username
");
}
else{
$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;
}
}


Hopefully this time it wont get mangled, but the hack works great I had no problems installing it on vb 2.3.0 rc1

Sho
03-16-2003, 01:20 PM
A real tracking solution would be nice. So it preserves the old action after refreshing itself - and only updates when there's something new. So after a few minutes and two dozen auto-refreshs, you'd have a list like this :

14:56: Looking at forum X
14:57: Creating new thread in forum X
15:02: Looking at new thread Y
15:03: Main Index

etc.

Erwin
03-16-2003, 09:22 PM
Please put the code for the hack in a TEXT file and attach it.

It allows people to download the code and store it. :)