i'm implementing CMR Application in CakePHP Framework 2x. In that app, i have a requirement of Online text Chat, Audio Chat, screen sharing and Video Chat. After searching quite a time, i have ended up with a decision of using CometChat 5.0 Platinum Edition. Work Progress:
- Placed Cometchat folder in webroot directory.
- Installed it correctly.
- Configured database correctly.
Actually right now i'm facing issues in using it with my Applicaton. For resolving issues i have searched google, but there is not a single place to tell me:
- How and Where to use getUserID() or chatLogin() function in CakePHP ?
- Where or What to do with session like: $_SESSION['basedata' and $session['session_auth_user_id'] etc, there are other many sessions variables that have no meaning with my table fields or tables it had created itself.
Right now it is showing chat bar tray correctly but The Error or Alert i have to see all the time is "Please login to use the chat", after analyzing, i came to know that ChometChat should know about logined user information to start but it seems it can only get it through the sessions or somewhere else, that i probably should know. If u think i had any integeration issues, i'm posting some code here, u can see it urself : (integeration.php)
Advanced Settings:
define('SET_SESSION_NAME',''); // Session name
define('DO_NOT_START_SESSION','1'); // Set to 1 if you have already started the session
define('DO_NOT_DESTROY_SESSION','0'); // Set to 1 if you do not want to destroy session on logout
define('SWITCH_ENABLED','1');
define('INCLUDE_JQUERY','1');
define('FORCE_MAGIC_QUOTES','0');
DATABASE Configurations:
define('DB_SERVER', 'localhost' );
define('DB_PORT', "3306" );
define('DB_USERNAME', 'root' );
define('DB_PASSWORD', '' );
define('DB_NAME', 'cakechat' );
define('TABLE_PREFIX', "" );
define('DB_USERTABLE', "users" );
define('DB_USERTABLE_USERID', "id" );
define('DB_USERTABLE_NAME', "username" );
define('DB_AVATARTABLE', " " );
define('DB_AVATARFIELD', " CONCAT(".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." ,CONCAT('/',".TABLE_PREFIX.DB_USERTABLE.".user_photo))" );
define('DB_USERTABLE_LASTACTIVITY', "user_lastactive");
Functions 1:
function getUserID() {
$userid = 0;
if (!empty($_SESSION['basedata']) && $_SESSION['basedata'] != 'null') {
$_REQUEST['basedata'] = $_SESSION['basedata'];
}
if (!empty($_REQUEST['basedata'])) {
$userid = $_REQUEST['basedata'];
}
if (!empty($_COOKIE['se_auth_token'])) {
$sql = ("select session_auth_user_id from ".TABLE_PREFIX."session_auth where session_auth_key = '".mysql_real_escape_string($_COOKIE['se_auth_token'])."'");
$query = mysql_query($sql);
$session = mysql_fetch_array($query);
$userid = $session['session_auth_user_id'];
}
return $userid;
}
My only request: Please share any reference link or walk-through to make things right and functional, any little effort, will be highly appreciated. Thanks in advance !