Community Videochat v.6.0
Installation/Integration manual

Home User profile integration

User profile integration

When you click on “View Profile” in the chat menu, the new chat window with profile opens and chat sends a request to profile handler to get the user profile information.

User profile has the structure shown on the picture below:



where user’s details that are on the right of the user’s photo have the key–value format and additional information is an html text.

For user’s details and additional information transmitting profile handler is used. It receives user name as a GET parameter ( $_GET[ 'user_name' ] ) and should return user profile information in the following XML format:

<profile>
<name>David</name>
<age>25</age>
<gender>Male</gender>
<info><![CDATA[Hello my name is …]]></info>
</profile>

The example of handler code:

<?php
//init request parameters
$userName = (isset($_GET["user_name"])) ? ($_GET["user_name"]) : "";

//Connect to users database
$db = mysql_connect('localhost','database_user_goes_here','database_password_goes_here') or die(mysql_error());
mysql_select_db('database_name',$db) or die(mysql_error());

//DB query
$sql = "SELECT * FROM users_table WHERE user_name='".$userName."'";
$result = mysql_query($sql,$db);

$userInfo= mysql_fetch_array($result);

$answer = '<profile>';
$answer .= '<name><![CDATA['.$userName.']]></name>';
$answer .= '<age>'.$userInfo['age'].'</age>';
$answer .= '<gender>'.$userInfo['gender'].'</gender>';
$answer .= '<country>'.$userInfo['country'].'</country>';
$answer .= '<city>'.$userInfo['city'].'</city>';
$answer .= '<info><![CDATA['.$userInfo['about_me'].']]></info>';
$answer .= '</profile>';

echo $answer;
exit;
?>


string login = this.Request.QueryString["name"];
string result = String.Empty;
DataTable userInfo = "SELECT FROM users WHERE name='login'";
if(userInfo.Rows.Count>0)
{
result+="<profile>";
result+="<name>"+userInfo.Rows[0]["name"]+"</name>";
result+="<gender>"+userInfo.Rows[0]["gender"]+"</gender>";
result+="<age>"+userInfo.Rows[0]["age"]+"</age>";
result+="<info><![CDATA["+userInfo.Rows[0]["info"]+"]]></info>";
result+="</profile>";
}
Response.Clear();
Response.Write(result);
Response.End();