Home
>
Outdated forums
>
Phorum 3 forums (READ ONLY)
>
Finished Mods and Plug-ins (READ ONLY)
>
Topic
>
Page 3
<b>[code] Who's Online</b>
Posted by <b>Vulpes</b>
Re: [code] Who's Online August 20, 2002 02:16PM |
Registered: 22 years ago Posts: 8 |
Checked and working on Dev-3.4 October 15, 2002 12:19PM |
Registered: 22 years ago Posts: 11 |
let me just ask you a little question:
Whos online, is checked for IP adresses ? i mean, the number of diferent IP adresses is the number of people online ?
I´m asking that, because sometimes i have lots of people in my forum with the same IP (i.e. students loging from a University, companies, etc).
Is there any way to check whos online from usernames ?
best regards ! great hack man !
Vip Money
Re: Checked and working on Dev-3.4 October 15, 2002 07:32PM |
Re: [code] Who's Online October 23, 2002 12:31PM |
Registered: 21 years ago Posts: 2 |
Don't know what I have done but I followed Curious Cat's advice, made a couple of cosmetic changes, and for some reason which ever browser I am in shows ONLY that person as being logged in. In otherwords, it never shows any other person(s) and/or guest(s) being logged it.
Other wise looks/works good.
Any advice? Note, I am maybe at best and "advanced" newbie with PHP. I understand conceptually but not as well from a practic standpoint.
Thanks for your help all.
- Brian
Other wise looks/works good.
Any advice? Note, I am maybe at best and "advanced" newbie with PHP. I understand conceptually but not as well from a practic standpoint.
Thanks for your help all.
- Brian
Re: [code] Who's Online November 02, 2002 08:38AM |
Registered: 21 years ago Posts: 9 |
Re: [code] Who's Online February 19, 2003 03:53PM |
Registered: 19 years ago Posts: 7 |
"shows ONLY that person as being logged in. In otherwords, it never shows any other person(s) and/or guest(s) being logged it."
I also got the same results. I installed this honestly minutes ago and haven't looked too deeply into it just yet - unfortunately no one else has posted the answer for me already ;)
GHXC
I also got the same results. I installed this honestly minutes ago and haven't looked too deeply into it just yet - unfortunately no one else has posted the answer for me already ;)
GHXC
alright, alright, i see how it is February 19, 2003 06:41PM |
Registered: 19 years ago Posts: 7 |
Re: [code] Who's Online February 19, 2003 08:39PM |
Registered: 19 years ago Posts: 14 |
hah, i'm with you on this one too February 20, 2003 03:36PM |
Registered: 19 years ago Posts: 7 |
For me, my name will show up when I'm on the board without a link UNLESS I am logged in. When I log in my name is linked to my profile.
Looking over the code, this makes sense. It is written so the "who's online" feature will work for users that post without logins and therefore have no profiles to link to. If you are you are not logged onto the board, it still picks up your name from the cookie, but it has no way of knowing whether or not you have an account. I might throw in a few lines so it includes the userid in the cookie, but right now I got some other things going on. If I change it up, I'll be sure to post my modifications here.
GHXC
Looking over the code, this makes sense. It is written so the "who's online" feature will work for users that post without logins and therefore have no profiles to link to. If you are you are not logged onto the board, it still picks up your name from the cookie, but it has no way of knowing whether or not you have an account. I might throw in a few lines so it includes the userid in the cookie, but right now I got some other things going on. If I change it up, I'll be sure to post my modifications here.
GHXC
Anonymous User
Re: [code] Who's Online February 25, 2003 05:01PM |
Re: hah, i'm with you on this one too March 13, 2003 10:06AM |
Registered: 19 years ago Posts: 9 |
Re: [code] Who's Online April 09, 2003 12:50AM |
Registered: 19 years ago Posts: 5 |
Anonymous User
Re: [code] Who's Online April 25, 2003 07:28AM |
Great MOD,
Great install document, curious_cat. Perhaphs you should add a comment on STEP 2 like.
STEP 2.
Using phpmyadmin ran the following:
CREATE TABLE whosonline (
ip char(15) NOT NULL default '',
ts timestamp(14) NOT NULL,
username char(255) NOT NULL default '',
forum char(250) NOT NULL default '',
PRIMARY KEY (ip),
KEY ts (ts),
KEY forum (forum)
) TYPE=MyISAM;
INSERT INTO whosonline VALUES ('record', 20011118030340, '1', 'Whatever');
If you don´t use phpmyadmin, make this:
* Connect to mysql server
host# mysql -h <host> -u root -p
* Select the correct database
mysql> USE <your_database_name_for_Phorum>
* Crate the new table for MOD whosonline
CREATE TABLE whosonline (
ip char(15) NOT NULL default '',
ts timestamp(14) NOT NULL,
username char(255) NOT NULL default '',
forum char(250) NOT NULL default '',
PRIMARY KEY (ip),
KEY ts (ts),
KEY forum (forum)
) TYPE=MyISAM;
* Insert a record
INSERT INTO whosonline VALUES ('record', 20011118030340, '1', 'Whatever');
Working fine on my Forum.
Regards,
Jesús
Great install document, curious_cat. Perhaphs you should add a comment on STEP 2 like.
STEP 2.
Using phpmyadmin ran the following:
CREATE TABLE whosonline (
ip char(15) NOT NULL default '',
ts timestamp(14) NOT NULL,
username char(255) NOT NULL default '',
forum char(250) NOT NULL default '',
PRIMARY KEY (ip),
KEY ts (ts),
KEY forum (forum)
) TYPE=MyISAM;
INSERT INTO whosonline VALUES ('record', 20011118030340, '1', 'Whatever');
If you don´t use phpmyadmin, make this:
* Connect to mysql server
host# mysql -h <host> -u root -p
* Select the correct database
mysql> USE <your_database_name_for_Phorum>
* Crate the new table for MOD whosonline
CREATE TABLE whosonline (
ip char(15) NOT NULL default '',
ts timestamp(14) NOT NULL,
username char(255) NOT NULL default '',
forum char(250) NOT NULL default '',
PRIMARY KEY (ip),
KEY ts (ts),
KEY forum (forum)
) TYPE=MyISAM;
* Insert a record
INSERT INTO whosonline VALUES ('record', 20011118030340, '1', 'Whatever');
Working fine on my Forum.
Regards,
Jesús
Portuguese MArio
Re: <b>[code] Who's Online</b> January 06, 2004 05:45PM |
Re: <b>[code] Who's Online</b> January 20, 2004 05:28PM |
Re: <b>[code] Who's Online</b> January 25, 2004 11:20PM |
Re: <b>[code] Who's Online</b> January 27, 2004 11:56AM |
Registered: 19 years ago Posts: 12 |
Anonymous User
Re: <b>[code] Who's Online</b> January 27, 2004 03:18PM |
Re: <b>[code] Who's Online</b> February 02, 2004 04:46PM |
I checked this out and for my taste this is a bit too lenghty way to archive something quite small so i made one myself.
First you need to make a changes to your forums_auth table (forums might be different in your setup but _auth will stand)
i did this by using mysql commandline utility.
ALTER TABLE forums_auth ADD seen int(15) not nulld default 0
If you are using myadmin or similar, you just enter one field (int(15)) more into the forums_auth table.
Next, we need to update this lastseen field *each* time user is either logged on OR is downloading a page. Best and obvious way is ofcourse to include this functionality in the header.php. In top of the header.php is following code:
if ( !defined( "_COMMON_PHP" ) ) return;
Just *after* but before closing ?> tag, add following code snippet:
$SQL = "UPDATE ".$PHORUM['auth_table']." SET seen=".time()." WHERE id=".$phorum_user['id'];
if ( ($phorum_user['id'])>0 ){
$q2 = new query($DB);
$q2 -> query($DB,$SQL);
}
Ok, when this is done, we have working Last Seen field in our database.
My site design is pretty much stock phorum and i didnt really put effort into integrating the data into the layout so i went the easy way: I will put the output of online users into footer.php
So, somewhere in your footer.php, put following code:
$sql = "select id,name,username,seen FROM ".$PHORUM['auth_table']." WHERE seen>=(unix_timestamp()-900)";
$q->query($DB,$sql);
while ($myrow=$q->getrow()) {
$id= $myrow['id'];
$name= $myrow['name'];
printf('<a href="profile.php?id=%s" class="onlinelist">%s|</a>',$id,$name);
}
So, basicly now we have an output from a script that prints *logged in* users who have been loading a page in last 15 minutes. If you want to change this value, change the number 900. Which is seconds, 15*60 == 900.
And remember, all code allways has to be inside <?PHP and ?> tags
You can see this "mod" running live on phorum 3.4.6 (It should work also in older versions) at [www.fi-reggae.com]
First you need to make a changes to your forums_auth table (forums might be different in your setup but _auth will stand)
i did this by using mysql commandline utility.
ALTER TABLE forums_auth ADD seen int(15) not nulld default 0
If you are using myadmin or similar, you just enter one field (int(15)) more into the forums_auth table.
Next, we need to update this lastseen field *each* time user is either logged on OR is downloading a page. Best and obvious way is ofcourse to include this functionality in the header.php. In top of the header.php is following code:
if ( !defined( "_COMMON_PHP" ) ) return;
Just *after* but before closing ?> tag, add following code snippet:
$SQL = "UPDATE ".$PHORUM['auth_table']." SET seen=".time()." WHERE id=".$phorum_user['id'];
if ( ($phorum_user['id'])>0 ){
$q2 = new query($DB);
$q2 -> query($DB,$SQL);
}
Ok, when this is done, we have working Last Seen field in our database.
My site design is pretty much stock phorum and i didnt really put effort into integrating the data into the layout so i went the easy way: I will put the output of online users into footer.php
So, somewhere in your footer.php, put following code:
$sql = "select id,name,username,seen FROM ".$PHORUM['auth_table']." WHERE seen>=(unix_timestamp()-900)";
$q->query($DB,$sql);
while ($myrow=$q->getrow()) {
$id= $myrow['id'];
$name= $myrow['name'];
printf('<a href="profile.php?id=%s" class="onlinelist">%s|</a>',$id,$name);
}
So, basicly now we have an output from a script that prints *logged in* users who have been loading a page in last 15 minutes. If you want to change this value, change the number 900. Which is seconds, 15*60 == 900.
And remember, all code allways has to be inside <?PHP and ?> tags
You can see this "mod" running live on phorum 3.4.6 (It should work also in older versions) at [www.fi-reggae.com]
Re: &lt;b&gt;[code] Who's Online&lt;/b&gt; February 04, 2004 12:51PM |
Sorry, you do not have permission to post/reply in this forum.