Admin Module

Return to the Module Documentation Index

The Idea

When a chat moderator is away, how will you ensure that your users "play nice"? How will you monitor for cussing, and even chat spamming (posting the same URL many times in a row)?

This module, when loaded, monitors for bad language and spam. If a cuss word, as defined in FlashChat's badwords.php file, or the module's own badwords.xml file, is used X times (where X is the frequency defined in the module's config.xml file), then the user is banned. Or, if they post the same URL X times, within a period of Y seconds, then the module assumes that this user is spamming the chat, and they are alerted that they should stop spamming the chat.


Locate the 'config.php' file within FlashChat's 'inc' folder. Open using a good text editor, like Textpad, and be very careful not to introduce PHP errors while editing. Be sure to backup your original config.php file, just in case you need to restore it.

Scroll down to the 'module' settings, and change the 'path' property to match the SWF path of the admin module. For example, like this:

	 'module' => array(
		'anchor'  => 0,
		'path'    => 'modules/admin/admin_module.swf',
		'stretch' => false,
		'float_x' => 300, 
		'float_y' => 200, 
		'float_w' => 100, 
		'float_h' => 100, 

For this module, the 'anchor', 'stretch', and float settings are irrelevant, since the module is invisible. It monitors the chat in the background, but there is no admin interface for this module other than the external XML files.

The important thing is to ensure that 'path' is set correctly. If you put the module files in a folder other than "admin", or if you recompiled the SWF using a different name, then obviously you'll have to adjust the 'path' value accordingly.


This module has two configuration files: badwords.xml, and config.xml. Let's first look at badwords.xml. This is set up very simply, as a series of <word>...</word> lines. These are the bad words which the module should check for. Thus, if you have:


Then, if the user inputs "blah" in 3 different chat messages within a short duration, the user will be banned from the chat. (hint: substitute "blah" for a well-known F-word cuss).

Asterisk symbols can be used for wild cards. If you would like to indicate that "blahing" or "blaher" are also bad words, then use:


If "motherblah" and "motherblaher" are also bad words, you might instead use:


Please note that the module will also use badwords.php, in FlashChat's "inc" folder, for bad words filtering... in other words, by default BOTH the modules's badwords.xml and FlashChat's own badwords.php are used to determine when a bad word is present.

Let's now take a look at config.xml. As noted previously, this module draws its bad words from BOTH badwords.xml, and badwords.php... but, what if I only wish to use badwords.xml? This can be done in config.xml, by changing:


to this:


Or, if you'd like to use only the XML file, and not the PHP file, you can change <use_php_badwords> to false, and set <use_xml_badwords> to true. You may be wondering: why would I want to use one file for badword filtering, but not both? This is because some user have changed badwords.php to filter other data. Let's say that you have a chat whereby you want to mask certain sensitive words (not bad words, but perhaps other terms which you don't want shown in your chat). Thus, the admin module would check for cussing, even if badwords.php isn't being used for that purpose.

Let's take a look at some other important settings in config.xml

<frequency> = The number of times which an event occurs. If the bad word is inputted 3 times, and <frequency>3</frequency> is set, then the user will be banned from the chat.

<time> = The duration in which <frequency> events must occur. Thus, even if you input a bad word 3 times, if this is done in a duration exceeding <time>, then the user will NOT be banned. You could set <time> to a very large setting, like 99999, if you want the user to be banned regardless of the interval between use of these bad words.

<action> = What action the module should take if the bad word is detected <frequency> times in <time> seconds. Use either ban_ip or alert for this value.

<message> = The message which should appear to the user after the module takes appropriate action.

When the anti-spam feature is enabled, inputting a URL multiple times quickly results in a popup alert. If <action> is set to ban_ip instead, then the user is banned when such spamming is detected. I recommend that you use alert instead of ban_ip for this feature, since in some cases, the user might not actually be spamming the chat. Use of bad words is more clear-cut, however, which is why ban_ip is the default action for bad words detection.

With the anti-spam feature enabled, repeating a URL frequently in a small time frame will alert the user, as shown below. Please note that FlashChat has a built-in anti-flooding control, which can be set using the 'floodInterval' property in /inc/config.php (the number of seconds that a user must wait before posting a new message).