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

Who is doesn\'t work!! Help

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

Post a reply
7 posts • Page 1 of 1

Postby cebronx » Wed Aug 30, 2006 12:10 pm

I have looked in the forums for answers to this problem. I have found some posts that gave me an idea of who is works. BUt for some reason it just doesn't work. this is the code Im testing right now.
Code: Select all
<?php

require_once dirname(__FILE__)."/src/phpfreechat.class.php";
$params["serverid"] = md5("cebronx_chat.php"); // calculate a unique id for this chat
$params["title"]    = "Whois online demo channel";
$pfc_config =& pfcGlobalConfig::Instance( $params );

?>
<?php

require_once dirname(__FILE__)."/src/pfcinfo.class.php";
$info  = new pfcInfo( md5("Whois online demo") );
// NULL is used to get all the connected users, but you can specify
// a channel name to get only the connected user on a specific channel
$users = $info->getOnlineNick(NULL);

echo "<h1>A demo which explains how to get the connected users list</h1>";

echo '<div style="margin: auto; width: 70%; border: 1px solid red; background-color: #FDD; padding: 1em;">';
$info = "";
$nb_users = count($users);
if ($nb_users <= 1)
  $info = "<strong>%d</strong> user is connected to the server !";
else
  $info = "<strong>%d</strong> users are connected to the server !";
echo "<p>".sprintf($info, $nb_users)."</p>";

echo "<p>Here is the nicknames' list:</p>";
echo "<ul>";
foreach($users as $u)
{
  echo "<li>".$u."</li>";
}
echo "</ul>";
echo "</div>";

?>

But some reason it always tells me that there is no one online when there is. Another thing when I go to my data/private/chat/ All I see there are folders with a lot of numbers is it possible to have probably the name of the file on those folders so I will understand them a little bit better. and Im saying this because I tried using this code to get the nicknames and what it gave me was the codes of the files instead of the nicknames.
Code: Select all
<?
$minute=10;
$chat_dir="data/private/chat/s_81c54ef162a9cc6a34d20135e16f1fe2/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>";
}
?>

Found this code on one of your threads. Can anyone help me. I would like to announce who is in the chatroom in my index page that way the users will know if to go in and expect anyone to be in there or not. Thanks in advance for the help.
Luis
cebronx
Member
 
Posts: 32
Joined: Mon Aug 28, 2006 3:22 am
Location: Bronx, NY
  • Website
Top

Postby phpfreechat » Wed Aug 30, 2006 1:03 pm

Could you also post the content of your chat script ?
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby cebronx » Wed Aug 30, 2006 1:30 pm

Here is the code
Code: Select all
equire_once "phpchat/src/phpfreechat.class.php"; // adjust to your own path
   $params = array();
    $params["serverid"] = md5(__FILE__); // used to identify the chat
   $params["channels"]       = array("CEBronx.ORG");
   $params["language"]      = "es_ES";
   $params["title"]          = "Capilla Evangelica del Bronx, Parker Street.";
     if ($desc == "administrador") $params["isadmin"] = true;
   $params["nick"]           = $user;  // setup the intitial nickname
   $params["prefix"]         = "myprefix_";
   $params["frozen_nick"]    = true;     // do not allow to change the nickname
   $params["shownotice"]     = 3;        // 0 = nothing, 1 = just nickname changes, 2 = connect/quit, 3 = nick + connect/quit
   $params["max_nick_len"]   = 20;       // nickname length could not be longer than 10 caracteres
   $params["max_text_len"]   = 300;      // a message cannot be longer than 50 caracteres
   $params["refresh_delay"]  = 2000;     // chat refresh speed is 2 secondes (10000ms)
   $params["max_msg"]        = 0;       // max message in the history is 15 (message seen when reloading the chat)
   $params["height"]         = "460px";  // height of chat area is 230px
   $params["width"]          = "800px";  // width of chat area is 800px
    $chat = new phpFreeChat($params);

This is not located in the phpfreechat folder but in the directory before it. ex. wwwroot/code above, wwwroot/phpchat/... phpfreechat folder
Thanks for your help!
Last edited by cebronx on Wed Aug 30, 2006 1:33 pm, edited 1 time in total.
Luis
cebronx
Member
 
Posts: 32
Joined: Mon Aug 28, 2006 3:22 am
Location: Bronx, NY
  • Website
Top

Postby phpfreechat » Wed Aug 30, 2006 1:53 pm

Ok, your code is wrong.
The serverid are different in the two scripts.

Try this code:
Code: Select all
<?php

require_once dirname(__FILE__)."/src/pfcinfo.class.php";
$info  = new pfcInfo( md5("cebronx_chat") );
// NULL is used to get all the connected users, but you can specify
// a channel name to get only the connected user on a specific channel
$users = $info->getOnlineNick(NULL);

echo "<h1>A demo which explains how to get the connected users list</h1>";

echo '<div style="margin: auto; width: 70%; border: 1px solid red; background-color: #FDD; padding: 1em;">';
$info = "";
$nb_users = count($users);
if ($nb_users <= 1)
  $info = "<strong>%d</strong> user is connected to the server !";
else
  $info = "<strong>%d</strong> users are connected to the server !";
echo "<p>".sprintf($info, $nb_users)."</p>";

echo "<p>Here is the nicknames' list:</p>";
echo "<ul>";
foreach($users as $u)
{
  echo "<li>".$u."</li>";
}
echo "</ul>";
echo "</div>";

?>

And this code for the script:
Code: Select all
    require_once "phpchat/src/phpfreechat.class.php"; // adjust to your own path
    $params = array();
    $params["serverid"] = md5("cebronx_chat"); // used to identify the chat
    $params["channels"]       = array("CEBronx.ORG");
    $params["language"]       = "es_ES";
    $params["title"]          = "Capilla Evangelica del Bronx, Parker Street.";
     if ($desc == "administrador") $params["isadmin"] = true;
    $params["nick"]           = $user;  // setup the intitial nickname
    $params["prefix"]         = "myprefix_";
    $params["frozen_nick"]    = true;     // do not allow to change the nickname
    $params["shownotice"]     = 3;        // 0 = nothing, 1 = just nickname changes, 2 = connect/quit, 3 = nick + connect/quit
    $params["max_nick_len"]   = 20;       // nickname length could not be longer than 10 caracteres
    $params["max_text_len"]   = 300;      // a message cannot be longer than 50 caracteres
    $params["refresh_delay"]  = 2000;     // chat refresh speed is 2 secondes (10000ms)
    $params["max_msg"]        = 0;       // max message in the history is 15 (message seen when reloading the chat)
    $params["height"]         = "460px";  // height of chat area is 230px
    $params["width"]          = "800px";  // width of chat area is 800px
    $chat = new phpFreeChat($params);

keep me informed.
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby cebronx » Wed Aug 30, 2006 2:00 pm

Now i get the following error.
"error: the xajax javascript file could not be included. Perhaps the url is incorrect?
URL: data/public/xjax_js/xajax.js"

This was after I refreshed the page.

I went back and changed the cebronx_chat with __FILE__ and its working fine again. What do you think was wrong? (This is not in the whois page but in the chatroom script)
Last edited by cebronx on Wed Aug 30, 2006 2:03 pm, edited 1 time in total.
Luis
cebronx
Member
 
Posts: 32
Joined: Mon Aug 28, 2006 3:22 am
Location: Bronx, NY
  • Website
Top

Postby phpfreechat » Wed Aug 30, 2006 5:32 pm

I think you need just clean the cache after setting the md5("cebronx_chat")


Close your browser window, go into data/private/cache/ and clear all the contained files.
Then open your browser and go to the script page.
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby cebronx » Wed Aug 30, 2006 5:54 pm

THANK YOU!! Thank you very much. I was thinking of doing that first but Im at work right now and the website is in a server in my house. Called my little sister told her what to delete and BOOM!!! Awesome. You are the best! Thanks a lot.!!! :D :D :D
Luis
cebronx
Member
 
Posts: 32
Joined: Mon Aug 28, 2006 3:22 am
Location: Bronx, NY
  • Website
Top


Post a reply
7 posts • Page 1 of 1

Return to General Support (v1.x)

Who is online

Users browsing this forum: No registered users and 13 guests

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