• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ Feature Requests (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

Chat User \'online\'

This forum is now locked as we will no longer be developing the v1.x branch

Moderators: OldWolf, re*s.t.a.r.s.*2

Topic locked
15 posts • Page 1 of 1

Postby Codebase » Sat Feb 11, 2006 8:47 pm

A function or a function call to indicate the amount of online user.

:)
Codebase
New member
 
Posts: 3
Joined: Thu Feb 09, 2006 6:55 pm
Top

Postby phpfreechat » Sat Feb 11, 2006 8:58 pm

I wrote a quick script which should be adapted for use :
Code: Select all
$users = array();
$dir = "your/phpfreechat/path/data/private/chat/yourchannelname/nicknames/";
$dir_handle = opendir($dir);
while (false !== ($file = readdir($dir_handle)))
{
  if ($file == "." || $file == "..") continue; // skip . and .. generic files
  if (time() > (filemtime($dir.$file)+10) ) // do not count 10 seconds oldest user
    continue;
  $users[] = urldecode(base64_decode($file));
}
$nd_users = count($users);

I will create an API for external calls but this is not planned for now because I have lot of things to do with 1.0 release ... if someone want to do the job, feel free :)
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby Daedalus » Tue Feb 14, 2006 1:28 pm

Would be great. Our Forum waits for this too.

But i have no knowlegde of programming. If i had i would make it.
Daedalus
New member
 
Posts: 2
Joined: Tue Feb 14, 2006 1:21 pm
Top

Postby DaveS » Sat Feb 18, 2006 10:54 pm

Why are the usernames encrypted in the nickname directory?
I was going to modify you script above to provide a "lobby" to my users, where the could see WHO was in the chatroom before actually entering it.... as well as of course the count
R.David Sisemore
Webmaster
Brothers of the Third Wheel
www.btw-trikers.org
DaveS
Member
 
Posts: 12
Joined: Sat Feb 18, 2006 5:02 pm
Location: San Diego, CA USA
  • Website
Top

Postby phpfreechat » Sun Feb 19, 2006 12:00 am

DaveS wrote:Why are the usernames encrypted in the nickname directory?

To make possible to have a none latin nickname. Or nickname with special chars.
If I don't encrypte it, it will make problem with filesystem.
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby DaveS » Sun Feb 19, 2006 12:11 am

So there is no way currently to show "WHO" is in chat? :((
R.David Sisemore
Webmaster
Brothers of the Third Wheel
www.btw-trikers.org
DaveS
Member
 
Posts: 12
Joined: Sat Feb 18, 2006 5:02 pm
Location: San Diego, CA USA
  • Website
Top

Postby phpfreechat » Sun Feb 19, 2006 12:16 am

Wrong, there is a way :)
Look above : my 1st reply.
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby DaveS » Sun Feb 19, 2006 4:35 pm

I figured it out.... and here is some code to implement a "lobby"... based on your code above which had a few bugs in it :D

<?
$minute=10;
$chat_dir="/www/htdocs/uploads/phpchat/data/private/chat/btwchat/nicknames/";
$users = array();
$dir_handle = opendir($chat_dir);
while (false !== ($file = readdir($dir_handle)))
{
if ($file == "." || $file == "..") continue; // skip . and .. generic files
if (time() > (filemtime($chat_dir.$file)+($minute *60))) continue; // do not count if older than specified time
$x=urldecode(base64_decode($file));
$users[] = urldecode(base64_decode($file));
}
$nd_users = count($users);
if ($nd_users==0)
{
echo "There is NOBODY in the Chatroom right now<br>";
}
else
{
echo "<table class=tbl border=1 cellspacing=0 cellpadding=3>";
echo "<tr><td class=row1>Users in the Chatroom<br>in the last $minute minutes</td></tr>";
for ($i=0; $i<$nd_users; $i++)
{
$x=$users[$i];
echo "<tr><td class=row2>$x</td><tr>";
}
echo "</table>";
}
?>
R.David Sisemore
Webmaster
Brothers of the Third Wheel
www.btw-trikers.org
DaveS
Member
 
Posts: 12
Joined: Sat Feb 18, 2006 5:02 pm
Location: San Diego, CA USA
  • Website
Top

Postby dpushman » Sat Apr 01, 2006 10:50 pm

But where exactly is this code going, in a new file or in the index, is it in the index.php then where. I tryed some solutions but i am not good in php.
dpushman
New member
 
Posts: 2
Joined: Fri Mar 31, 2006 9:02 am
Location: Norway
  • Website
Top

Postby phpfreechat » Thu Apr 06, 2006 2:45 pm

in a new file : where you want to show the connected users list, somewhere on your website I guess
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby Yautja_cetanu » Thu Apr 20, 2006 11:44 pm

I was going to modify you script above to provide a "lobby" to my users, where the could see WHO was in the chatroom before actually entering it.... as well as of course the count

Take a look at our forums, www.thevirtualreality.co.uk We have that integrated in the "Who is online" in phpbb. I'll pester our scriptor to post the phpbb mods, etc. However we are waiting for the release of version 1.0 before we start as some of it will depend on how private messages, etc are implemented.
Yautja_cetanu
Member
 
Posts: 18
Joined: Sat Feb 25, 2006 1:47 am
Top

Postby phpfreechat » Fri Apr 21, 2006 7:46 am

With 1.0 release, an API will be available to ckeck the online user list on a given channel, to get the last N messages on a channel etc ...
So I should be very easy to add a such MOD to phpbb and everything else.
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby roschler » Mon Oct 23, 2006 3:32 pm

Kerphi,

Was the API ever created? If so, where can I find it or an example on how to use it?

Thanks.
roschler
Member
 
Posts: 23
Joined: Thu Oct 19, 2006 6:44 pm
Top

Postby phpfreechat » Mon Oct 23, 2006 3:44 pm

Yes, see these demo :
http://www.phpfreechat.net/demo/pfc-1.x ... e-chat.php
http://www.phpfreechat.net/demo/pfc-1.x ... online.php
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby seb » Mon Apr 09, 2007 2:08 pm

hello,

It almost fine. I'm using v1.08 and i think i have to change the path to:
$chat_dir="/www/htdocs/uploads/phpchat/data/private/chat/btwchat/metadata-to-nickid/nick/";

After that the script is showing the names like:

IæÚ²Øšj

This is wrong. Does somebody knows what wrong in my script?

Seb.
Last edited by seb on Mon Apr 09, 2007 2:15 pm, edited 1 time in total.
seb
Member
 
Posts: 12
Joined: Fri Mar 23, 2007 12:24 pm
Top


Topic locked
15 posts • Page 1 of 1

Return to Feature Requests (v1.x)

Who is online

Users browsing this forum: No registered users and 1 guest

  • Board index
  • The team • Delete all board cookies • All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
cron
Sign in
Wrong credentials
Sign up I forgot my password
.
jeu-gratuit.net | more partners
Fork me on GitHub