Community Messenger v.6.0
Installation/Integration manual

Home Handlers

What is a handler.

A handler is a server script, that returns data (usually in XML format) to the application upon request. For example, it can return user profile information or user authorization information.

All handlers can be edited in the application main settings file /flashcoms/Community Messenger/settings/main.xml, however, make sure you’re not removing markers, like: {ROOT}, {NAME} and {UID}. These are system markers in which the application inserts the appropriate values.

Depending on the application and handler you may find several different markers. The most commonly used markers are:

ROOT root folder for all flashcoms applications (PROJECT_HTTP_ROOT/flashcoms/).
NAME user name.
UID user identifier (used  when site authorization is not session/cookies based)

{ROOT} marker value ends with “/”, so if you change the path of the handler file to, for example, /avatar.php located in the PROJECT_HTTP_ROOT folder, then the new address path should look like this: {ROOT}../avatar.php

Community Messenger handlers

Handlers can be edited in the handlers sections of the main settings file (/flashcoms/Community Messenger/settings/main.xml)


<auth> <![CDATA[ {ROOT}Community Messenger/server/php/handlers.php?action=auth&uid={UID} ]]</auth>

<profile><![CDATA[ {ROOT}Community Messenger/server/php/handlers.php?action=getProfile&userName={NAME} ]]></profile>

<userInfo><![CDATA[ {ROOT}Community Messenger/server/php/handlers.php?action=photo&userName={NAME} ]]></userInfo>

<uploadDownloadFile>< ![CDATA[ {ROOT}common/server/php/file.php ]] ></uploadDownloadFile>


Authorization handler

<auth> <![CDATA[ {ROOT}Community Messenger/server/php/handlers.php?action=auth&uid={UID} ]]</auth>

Authorization handler allows you to integrate the Community Messenger with your web site users' database.


UID - optional parameter which receives user identifier that has been passed to the application. Used for non session/cookies based authorization.

If authorization is passed successfully:

<auth error="">


Node name Description
userName Required. User login name.
gender User's gender. Can take 'male', 'female' or 'couple' value. Required when avatar mode is set to "gender"
level User's authorization level. Required when limitation plugin is installed.

If not authorized:

<auth error="AUTH_ERROR" />

 Example code below illustrates the handler logic:

//check if is set session variable

echo '< site_auth error="AUTH_ERROR" >;
//connect to users database

$db = mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die(mysql_error());
mysql_select_db(DB_NAME,$db) or die(mysql_error());

//select information for current user from database

$sql = "SELECT * FROM users_table WHERE user_id=".$_SESSION["user_id"];
$result = mysql_query($sql,$db);
$users_row = mysql_fetch_array($result);

//return information about user in xml format to the Community Messenger

echo '< auth error="" >';
echo '< name >'.$users_row['user_name'].'< /name >';
echo '< level >'.$users_row['user_gender'].'< /level >';
echo '< /auth >';
//where $_SESSION["user_id"] is a session variable which is initialized when a user logged in to your site

Profile handler

Returns user’s profile information.


userName – user name.

Format of the returned data

<paramName>value</paramName >



<info>my info </info>
<photo width="80" height="80"></photo>

//select information for current user from database
$sql = "SELECT * FROM users_profile_table WHERE user_name LIKE ‘".$_GET["userName"].”’”;
$result = mysql_query($sql,$db);
$users_row = mysql_fetch_array($result);
//return information about user in xml format to the Community Messenger
echo '<profile>';
echo '<name>'.$users_row['user_name'].'</name>';
echo '<gender>'.$users_row['user_gender'].'</gender>';
echo '<age>'.$users_row['user_age'].'</age>';
echo '<info>'.$users_row['user_info'].'</info>';
echo '<country>'.$users_row['user_ country'].'</country>';
echo '<photo width="80" height="80">'. ''.$users_row['user_photo']. '</photo>';
echo '</profile>';

$_GET["userName"] is a user name variable which we get from Flashcoms Community Messenger

Info handler


userName – user name

Returnes xml data.

Format of the returned data

<name>value</name >


<name>Some Name </name >


Profile photo image size is 80x80 pixels, however if you pass an image of a larger or smaller size it will be resized automatically. Nevertheless, we do not recommend to pass images larger than 300x300 pixels.