Authorization handler

<auth><![CDATA[
{ROOT}videochat/server/php/handlers.php?action=auth&user_name={NAME}&password={PASSWORD}&uid={UID}
]]></auth>

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

Parameters:

NAME - user name
PASSWORD - user password
UID - user id (used with non session/cookie based web site authorization)

Format of the returned data

If authorization is passed successfully:

<auth>
<userName><![CDATA[USERNAME]]></userName>
<gender>male</gender>
<level>regular</level>
<photo><![CDATA[PATH_TO_USER_PHOTO]]></photo>
<photoModeImage><![CDATA[PATH_TO_USER_AVATAR_PHOTO]]></photoModeImage>
</auth>

where:

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.
photo Path to user's photo/image file. Recommended image size 100x100 px.
photoModeImage Path to user's photo-avatar. Required when avatar mode is set to "photo". Recommended image size 30x30 px.

If not authorized:

<auth error="AUTH_ERROR" />

Authorization handler serves both Auto Login and Chat Authorization requests. Example code below illustrates the handler logic:

if($_REQUEST['user_name']!="" && $_REQUEST['password']!="")
{
//Chat authorization - a user has specified login/password on the chat welcome screen
}
else if ($_SESSION['uid']!="")
{
// Autologin session/cookie based authorization
}
else if ($_GET['uid']!="")
{
// Non session/cookie based autologin authorization
}
else
{
return '<auth error="AUTH_ERROR" />';
}