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/updater/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 |
Updater handler
Updater handler can be edited in the handlers sections of the main settings file (/flashcoms/updater/settings/main.xml):
|
<handlers>
<auth><![CDATA[
{ROOT}updater/server/php/handlers.php?action=auth&uid={UID}
]]></auth>
</handlers>
|
Authorization handler allows you to integrate the Community Messenger with your web site users' database.Parameters:
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="">
<userName><![CDATA[USERNAME]]></userName>
</auth>
|
where:
| Node name |
Description |
| userName |
Required. User login name. |
| gender |
User's gender. Can take 'male', 'female' or 'couple' value. |
| 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
if(!isset($_SESSION["user_id"]))
echo '< auth error="AUTH_ERROR" />';
else { //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 updater echo '< auth error="">';
echo '< userName>'.$users_row['user_name'].< /userName>';
echo '< /auth>';
}
//where $_SESSION["user_id"] is a session variable which is initialized when a user
logged in to your site
|
|