====== Admin ======
Php Free Chat offers three basic options for setting up admin. To learn how to add a parameter, or to see other parameters, visit the [[parameters]] page.
==== The 'admins' Parameter ====
The admins parameter is best for set-ups which do not have a registration system of some kind. If you've downloaded phpfreechat from this site and made no changes, this applies to you! The admin parameter works in two steps. For the following example, assume that Bob and John are each admin, with respective passwords of bobrocks and johnstheman (please use more secure passwords!).
$params['admins'] = array('Bob' => 'bobrocks', 'badman' => 'badman1');
Note that if you have more admin you'll simply add another comma, then the same 'Username' => 'Password' format.
Make sure to save and upload your changes to the server.
Now that it's on the server, login to the chat. If your chat gives you the option, type in the admin name. If not, once inside the chat type "/nick Bob". Once your name matches the admin user name, simply type "/identify bobrocks" where bobrocks is your password. After a few seconds, you should see your name gain a little shield next to in in the user list... congratulations, your an admin!
==== The 'firstisadmin' Parameter ====
All firstisadmin does is, you guessed it, sets the first person connected to the server to admin. To use this parameter, simply set the following code into your parameter list as described above.
$params['firstisadmin'] = false;
==== The 'isadmin' Parameter ====
The isadmin parameter sets each user's admin permissions on an individual basis. The advantage to it is that no password is necessary... the disadvantage is that no password is necessary!
In the following example, each user is granted admin permissions.
$params['isadmin'] = true;
The code above is really not recommended, since any ol' user entering the chat then becomes admin. The isadmin parameter is more useful for special applications. A good example of where it might come in handy is if you have a user system like phpbb which you have integrated with Php Free Chat (please note that the plain vanilla version of Php Free Chat does NOT include a user management system of any kind). In the following example we'll use "user_is_admin()" as our user management systems way of giving a true false output indicating if a user is an admin or not. Obviously each system will vary, so you will need to find the correct function for your system.
if(user_is_admin()) {
$params['isadmin'] = true;
} else {
$params['isadmin'] = false;
}
This would then use your user system to check to see if a user should have admin or not, and grant it to them accordingly.