====== Frequently Asked Questions (FAQ) ====== This page is for 1.x phpfreechat versions. For 2.x versions, check its [[:documentation:|documentation]]. ===== Why do IE 8.x and Safari cause the chat to look so strange? ===== Please note this issue only exists in PHP Free Chat v1.2 and older. PHP Free Chat 1.3 fixes this issue. This is a problem having to do with how css is parsed in the new browsers. Unfortunately the changes broke several pages, including phpfreechat's chatroom. The easiest solution is to insert the following meta tag somewhere in your html headers (between the and tags): ===== Why doesn't my code that includes $_GET/$_POST work? ===== $_GET and $_POST do NOT work well with this chat. It is recommended that you use $_SESSION, by setting whatever get/post values you will need into the session on a page BEFORE the chat page, then redirect to the chat page (by default, the chat page would be index.php). ===== How do I make the chat ask for a nickname? ===== To set the chat so that users have to input their nick, you will need to remove the 'nick' parameter on your index.php file (see parameters below). ===== How do I customize the chat? ===== To customize the chat you will need to add/delete/modify parameters from index.php. You can find more info on the [[parameters]] page. ===== Where can I find a list of commands for the chat? ===== To see a list of commands type "/help" into the chat, OR visit the [[commands]] page. ===== How do I clear the history of the chat for a new user? ===== Set the "[[parameters#max_msg]]" parameter to 0: ===== Why does phpFreeChat not work using Free.fr internet provider ? ===== The chat uses sessions. To make sessions work with Free.f,r users should create a folder named "sessions" on the root of their site. Use the ftp command "mkdir sessions" to create the folder. __Attention:__ this provider is no more supported because the flock php function is unavailable on there servers. ===== My filesystem is slow, how can I improve performance ? ===== //(for Linux users)// For windows users, have a look to [[http://www.jurixt.com/xp/xp_18.htm|this link]] or [[http://www.generation-nt.com/astuces/imprimer/124/|this link]]. By default, the chat data (messages and nicknames) are stored into "phpfreechat/data/private/chat/" but this path is customizable. On linux it exists an interesting feature which will improve drastically the filesystem performances, this is //tmpfs//. In fact, it is a memory based filesystem, the read/write access will be very fast but your data will be lost on the next reboot. On my Linux box (debian, kernel-2.6.x), a default //tmpfs// filesystem is mounted on "/dev/shm" so I suggest to configure phpfreechat to store chat data into this directory. To do that, just add this parameter : $params["serverid"] = md5(__FILE__); $params["data_private_path"] = "/dev/shm/mychat"; $chat = new phpFreeChat($params); [...] For your information, I did a benchmark test : Without tmpfs (HD) : * 10000 writes = **9.07 sec (82.49%)** * 10000 reads = 0.38 sec (3.49%) * 10000 removes = 0.31 sec (2.84%) With tmpfs (RAM) : * 10000 writes = **0.70 sec (6.37%)** * 10000 reads = 0.40 sec (3.64%) * 10000 removes = 0.12 sec (1.16%) ===== How to create multiple channels (rooms) ? ===== //(only for 0.x branche)// By default, the "channel" parameter is auto-generated (based on the "title" parameter), but it's possible to specify it in order to create totally independents channels. To handle multiple independent channels into one script passing the channel name by URL, just configure the chat like this : $params["serverid"] = md5(__FILE__); $params["channel"] = $_GET["channel"]; $chat = new phpFreeChat($params); [...] When browsing the script, for example ''http://.../mychat.php?channel=myroom'', a totally private chat will be created and data will be stored into "phpfreechat/data/private/chat/myroom/". ===== How to rehash the chat ? ===== //(only for 1.x branche)// Rehash is needed when you change a value in your parameter list. If you don't rehash the chat, the old value will be used because the chat uses a cache. To rehash the chat, you just have to run: /rehash However, you must be admin to run this command. To identify yourself as an admin, by default (if you didn't change the admin password) you just have to run these commands: /nick admin /identify (by default, the admin user don't have any password, but you can [[#how-to-change-the-chat-admin-password|change it]]) If you specifed a password for the admin you have to type: /identify password In special cases, you cannot access the chat to run the "/rehash" command. An alternative is to manually delete the "data/private/cache/" directory content. ===== How to change the chat admin password ? ===== //(only for 1.x branche)// Administrators (user/password) are defined in the "admins" parameter array. Example: suppose I want to make "bob" and "boby" admins with "bobpw" and "bobypw" as passwords. I just have to add this parameter: $params['admins'] = array('bob' => 'bobpw', 'boby' => 'bobypw'); (don't forget to [[#how-to-rehash-the-chat|rehash]] your chat) ===== How to connect PunBB nicknames to phpfreechat ? ===== You have to put this piece of code at beginning of your chat script: session_start(); if (!isset($_SESSION['punbb_to_pfc_nickname'])) { define('PUN_ROOT', dirname(__FILE__).'/forum/'); // adjust this path to your forum installation root require PUN_ROOT.'include/common.php'; $userdata = array(); check_cookie($userdata); if ($userdata['username'] == 'Guest') $userdata['username'] .= rand(1,1000); // generate a random guest username $_SESSION['punbb_to_pfc_nickname'] = $userdata['username']; } Then you can write the classic phpfreechat parameter list using "$_SESSION['punbb_to_pfc_nickname']" as the phpfreechat nickname. For example: require_once "src/phpfreechat.class.php"; $params["serverid"] = md5(__FILE__); $params["title"] = "phpFreeChat connected to the PunBB forum"; $params["channels"] = array("General","PunBB support"); $params["language"] = "en_US"; $params["nick"] = $_SESSION['punbb_to_pfc_nickname']; $chat = new phpFreeChat($params); ===== How to connect phpBB (version 3) nicknames to phpfreechat ? ===== At the beginning of your chat script (index.php) before session_begin(); $auth->acl($user->data); $user->setup(); if ($user->data['user_id'] == ANONYMOUS) { login_box('', $user->lang['LOGIN']); } ?> Make sure the variable $phpbb_root_path is correct. So if your forums are at example.com/forums and chat is at example.com/forums/chat, then PHPBB_ROOT_PATH should be ../ because you need to go back one directory. (As shown in the example). If you don't want the script to redirect to the login page if you are not logged in, then take out this part: if ($user->data['user_id'] == ANONYMOUS) { login_box('', $user->lang['LOGIN']); } Then, for your phpFreeChat Parameters, your "nick parameter" should look like this: $params["nick"] = $user->data['username_clean']; //One quick note: username_clean will take out any "weird" characters, including spaces and replace them with an underscore (_). If you want the regular username to be shown, change// $user->data['username_clean']; //to// $user->data['username']; If you also want your boards admins to automatically be made an admin in chat (so you can kick and ban), then add this to your parameters: if ($user->data['group_id'] == 4 OR $user->data['group_id'] == 5) // Admins and Moderators { $params["isadmin"] = true; // Do what you want cause a pirate is free, you are a pirate ;) } Be sure to change the number 4 and 5 to your boards Admin and moderator group numbers. To find your boards admin and moderator group number, navigate to your Boards index page of phpBB and scroll down to the "Who is Online" area. There is a legend for "Administrators" and "Global Moderators". Click on Administrators. Once you click it, the url in your browser should look something like this: http://example.com/forums/memberlist.php?mode=group&g=5 Take note of the &g= number in the url. That number is your admins group number. In this example, our admin group number is 5. Do the same for Global Moderators, in this example, our moderator group is 4. In the end, this is how my index.php looks after all the code is included and setup correctly. session_begin(); $auth->acl($user->data); $user->setup(); if ($user->data['user_id'] == ANONYMOUS) { login_box('', $user->lang['LOGIN']); } ?> data['username_clean']; $params['firstisadmin'] = false; if ($user->data['group_id'] == 4 OR $user->data['group_id'] == 5) // Admins and Moderators { $params["isadmin"] = true; // Do what you want cause a pirate is free, you are a pirate ;) } $params["serverid"] = md5(__FILE__); // calculate a unique id for this chat $params["debug"] = false; $chat = new phpFreeChat( $params ); ?> Chicken Talk Chat Room
printChat(); ?>
This is for basic Integration with phpBB. If you have any questions you can post in the forums. ===== How to connect FUDforum nicknames to phpfreechat? ===== You have to put this piece of code at the beginning of your phpFreeChat chat script (index.php): require_once("../forum/GLOBALS.php"); fud_use('db.inc'); fud_use('cookies.inc'); fud_use('users.inc'); $fuduser = init_user(); if ($fuduser->alias == $ANON_NICK) $fuduser->alias = 'guest'.rand(1,1000); // generate random nick Then you can write the classic phpfreechat parameter list using ''$fuduser->alias'' as the phpfreechat nickname. For example: require_once dirname(__FILE__)."/src/phpfreechat.class.php"; $params["serverid"] = md5(__FILE__); $params["title"] = "FUDforum chat"; $params["channels"] = array("FUDforum support", "General"); $params["language"] = "en_US"; $params["nick"] = $fuduser->alias; $chat = new phpFreeChat( $params ); For more info, see http://cvs.prohost.org/index.php/PhpFreeChat ===== How to upgrade phpfreechat ? ===== Suppose that you need to upgrade from "1.0-beta8" to "1.0-beta10" and you have this file structure on your server: /your/web/site/root/chat.php /your/web/site/root/phpfreechat-1.0-beta8/ /your/web/site/root/phpfreechat-1.0-beta10/ Before the upgrade, "chat.php" script should have something like that: require_once dirname(__FILE__).'/phpfreechat-1.0-beta8/src/phpfreechat.class.php'; $params['serverid'] = md5(__FILE__); $chat = new phpFreeChat($params); To upgrade you just have to change the require_once line: require_once dirname(__FILE__).'/phpfreechat-1.0-beta10/src/phpfreechat.class.php'; $params['serverid'] = md5(__FILE__); $chat = new phpFreeChat($params); __Notice:__ "phpfreechat-1.0-beta8" and "phpfreechat-1.0-beta10" directories are just simple unzipped phpfreechat source code that you can found on the download page. ===== How to change the chat timezone ? ===== First of all, take care that the php internal timezone flag is correctly setup. For example, if you want to force the chat to be executed in France, put this code at beginning of your chat script (only available on php5) : date_default_timezone_set('Europe/Paris'); If changing the php timezone in not enough you'll have to play with the [[parameters#time_offset|time_offset]] parameter. For example, if you want to advance the time for 2 hours : $params['time_offset'] = 60*60*2; // offset in seconds ===== How to disable word censoring ? ===== Word censoring is implemented as a command proxy. To disable it, you just have to disable the 'censor' proxy. Just add this parameter : $params['skip_proxies'] = array('censor'); (don't forget to [[#how-to-rehash-the-chat|rehash]] your chat) ===== Where is my "chat script" ? ===== The chat script is the php script which is run when the clients load the chat. All the chat parameters are located in this php file. By default, this script is used for loading the chat and for all the future AJAX calls. You can found a very simple chat script in "**phpfreechat-x.x/index.php**" ===== I'm not able to delete some files into phpfreechat directory, why ? ===== phpFreeChat needs write access to ''data/private/'' and ''data/public/'' directories. These directories will be used to store cached data and some public resources (images, css, js). Most of the time, these files will be created by the webserver user ("www-data" on debian). A problem could occur when the webserver rights are different from the user rights (ftp user, ssh user ...). This is why the user will not be able to remove (rm, mv, chmod) these files because he isn't the owned. To solve this problem, you have write a little script that will destroy these files. Then execute this script from your browser so that the files will be destroyed using the webserver rights. Another option is to ask your administrator to remove these files in your place or to configure the server to have the same rights as the webserver. ===== How to create SQL tables for the mysql container ? ===== You don't have to create it manually. It will be created automatically at first chat loading. Of course the username has to have the rights to create a new table. Please check the [[parameters#containers-parameters-list|mysql container parameters description]] for more informations.