Welcome to Geeklog, Anonymous Friday, November 29 2024 @ 08:57 pm EST
Geeklog Forums
Flashchat - Geeklog autologin
Status: offline
mmarquez
Forum User
Newbie
Registered: 04/10/06
Posts: 5
I installed Flashchat since PhpMychat does not support the amount of users i need it to support.
It worked well in the beginning, with autologin and everything, but it couldn't handle the load, so I enabled the socketserver in Flashchat and it is working great as far as speed/load.
The problem is that enabling socketserver makes it impossible for the Geeklog users to autologin, they have to re-enter their info to get into the chat. ¿Anybody has been able to get autologin to work with socketserver in Flashchat?
Thanks!
mm
It worked well in the beginning, with autologin and everything, but it couldn't handle the load, so I enabled the socketserver in Flashchat and it is working great as far as speed/load.
The problem is that enabling socketserver makes it impossible for the Geeklog users to autologin, they have to re-enter their info to get into the chat. ¿Anybody has been able to get autologin to work with socketserver in Flashchat?
Thanks!
mm
12
15
Quote
Status: offline
mmarquez
Forum User
Newbie
Registered: 04/10/06
Posts: 5
Can someone check out this php file that Flashchat uses to integrate with Geeklog?
Any help would be greatly appreciated as to what is missing from the configuration...
<?php
/************************************************************************/
//!!! IMPORTANT NOTE
//!!! FlashChat 4.4.0 and higher support a new user role: ROLE_MODERATOR
//!!! Please edit the getUser and getRoles function if you need use of
//!!! the new moderator role. This change has not yet been applied.
/************************************************************************/
$gl_path = realpath(dirname(__FILE__) . '/../../../') . '/';
include($gl_path . 'lib-common.php');
class GeekLogCMS {
function GeekLogCMS() {
$this->dummy = NULL;
}
// See if user is logged in. Works
function isLoggedIn() {
//global $_USER;
global $_CONF;
//return $_USER ? $_USER['uid'] : null;
return isset($_COOKIE[$_CONF['cookie_name']]) ? $_COOKIE[$_CONF['cookie_name']] : NULL;
}
// performs user login using provided login and password, return logged in user id, otherwise returns null
function login($login, $password) {
global $_USER, $_CONF, $_TABLES;
if (COM_getPassword($login) == md5($password)) {
DB_change($_TABLES['users'],'pwrequestid',"NULL",'username',$login);
$_USER=SESS_getUserData($login);
$sessid = SESS_newSession($_USER['uid'], $REMOTE_ADDR, $_CONF['session_cookie_timeout'], $_CONF['cookie_ip']);
SESS_setSessionCookie($sessid, $_CONF['session_cookie_timeout'], $_CONF['cookie_session'], $_CONF['cookie_path'], $_CONF['cookiedomain'], $_CONF['cookiesecure']);
if (!isset($HTTP_COOKIE_VARS[$_CONF["cookie_name"]]) || !isset($HTTP_COOKIE_VARS['password'])) {
$cooktime = COM_getUserCookieTimeout();
if ($cooktime > 0) {
setcookie ($_CONF['cookie_name'], $_USER['uid'],time() + $cooktime, $_CONF['cookie_path'], $_CONF['cookiedomain'],$_CONF['cookiesecure']);
setcookie ($_CONF['cookie_password'], md5($password),time() + $cooktime,$_CONF['cookie_path'],$_CONF['cookiedomain'], $_CONF['cookiesecure']);
}
} else {
$userid = $HTTP_COOKIE_VARS[$_CONF['cookie_name']];
if (empty ($userid) || ($userid == 'deleted')) {
unset ($userid);
} else {
if ($userid) {
$user_logged_in = 1;
// Create new session
$userdata = SESS_getUserDataFromId($userid);
$_USER = $userdata;
}
}
}
setcookie ($_CONF['cookie_theme'], $_USER['theme'], time() + 31536000,$_CONF['cookie_path'], $_CONF['cookiedomain'],$_CONF['cookiesecure']);
return $_USER['uid'];
}
return null;
}
// performs logging out for actual user, Works
function logout(){
}
// returns used data for provided user id. User data is an array like:
// array(
// 'id' => <user id>,
// 'login' => <user login>,
// 'roles'=> ROLE_USER for users, ROLE_ADMIN for admins, or ROLE_USER | ROLE_ADMIN if user has both roles
// );
// ROLE_USER and ROLE_ADMIN are constants defined in inc/common.php
// returns null if such user is not found
function getUser($userid) {
global $_TABLES;
$u = null;
if ($userid) {
$u['id']=$userid;
$u['login'] = DB_getItem($_TABLES['users'],"username","uid=".$userid);
$u['roles'] = $GLOBALS['fc_config']['liveSupportMode']?ROLE_CUSTOMER:ROLE_USER;
$array = explode(",",SEC_getUserPermissions('',$userid));
foreach($array as $k => $v){
if($v == 'user.edit'){
$u['roles'] = ROLE_ADMIN;
break;
}
}
return $u;
}
return null;
}
function getUsers() {
global $_TABLES;
$stmt = new Statement("SELECT uid as id, username as login FROM ".$_TABLES['users']);
return $stmt->process();
}
// returns URL of user profile page for such user id or null if user not found
function getUserProfile($userid) {
if($userid == SPY_USERID) return null;
global $_CONF;
return $_CONF['site_url'] . "/users.php?mode=profile&uid=$userid";
}
// checks user role
function userInRole($userid, $role) {
if($user = $this->getUser($userid)) {
return ($user['roles'] == $role);
}
return false;
}
function getGender($userid) {
// 'M' for Male, 'F' for Female, NULL for undefined
return NULL;
}
}
$GLOBALS['fc_config']['db'] = array(
'host' => $_DB_host,
'user' => $_DB_user,
'pass' => $_DB_pass,
'base' => $_DB_name,
'pref' => $_DB_table_prefix . 'fc_'
);
foreach($GLOBALS['fc_config']['languages'] as $k => $v) {
$GLOBALS['fc_config']['languages'][$k]['dialog']['login']['moderator'] = '';
}
$GLOBALS['fc_config']['cms'] = new GeekLogCMS();
?>
Any help would be greatly appreciated as to what is missing from the configuration...
Text Formatted Code
<?php
/************************************************************************/
//!!! IMPORTANT NOTE
//!!! FlashChat 4.4.0 and higher support a new user role: ROLE_MODERATOR
//!!! Please edit the getUser and getRoles function if you need use of
//!!! the new moderator role. This change has not yet been applied.
/************************************************************************/
$gl_path = realpath(dirname(__FILE__) . '/../../../') . '/';
include($gl_path . 'lib-common.php');
class GeekLogCMS {
function GeekLogCMS() {
$this->dummy = NULL;
}
// See if user is logged in. Works
function isLoggedIn() {
//global $_USER;
global $_CONF;
//return $_USER ? $_USER['uid'] : null;
return isset($_COOKIE[$_CONF['cookie_name']]) ? $_COOKIE[$_CONF['cookie_name']] : NULL;
}
// performs user login using provided login and password, return logged in user id, otherwise returns null
function login($login, $password) {
global $_USER, $_CONF, $_TABLES;
if (COM_getPassword($login) == md5($password)) {
DB_change($_TABLES['users'],'pwrequestid',"NULL",'username',$login);
$_USER=SESS_getUserData($login);
$sessid = SESS_newSession($_USER['uid'], $REMOTE_ADDR, $_CONF['session_cookie_timeout'], $_CONF['cookie_ip']);
SESS_setSessionCookie($sessid, $_CONF['session_cookie_timeout'], $_CONF['cookie_session'], $_CONF['cookie_path'], $_CONF['cookiedomain'], $_CONF['cookiesecure']);
if (!isset($HTTP_COOKIE_VARS[$_CONF["cookie_name"]]) || !isset($HTTP_COOKIE_VARS['password'])) {
$cooktime = COM_getUserCookieTimeout();
if ($cooktime > 0) {
setcookie ($_CONF['cookie_name'], $_USER['uid'],time() + $cooktime, $_CONF['cookie_path'], $_CONF['cookiedomain'],$_CONF['cookiesecure']);
setcookie ($_CONF['cookie_password'], md5($password),time() + $cooktime,$_CONF['cookie_path'],$_CONF['cookiedomain'], $_CONF['cookiesecure']);
}
} else {
$userid = $HTTP_COOKIE_VARS[$_CONF['cookie_name']];
if (empty ($userid) || ($userid == 'deleted')) {
unset ($userid);
} else {
if ($userid) {
$user_logged_in = 1;
// Create new session
$userdata = SESS_getUserDataFromId($userid);
$_USER = $userdata;
}
}
}
setcookie ($_CONF['cookie_theme'], $_USER['theme'], time() + 31536000,$_CONF['cookie_path'], $_CONF['cookiedomain'],$_CONF['cookiesecure']);
return $_USER['uid'];
}
return null;
}
// performs logging out for actual user, Works
function logout(){
}
// returns used data for provided user id. User data is an array like:
// array(
// 'id' => <user id>,
// 'login' => <user login>,
// 'roles'=> ROLE_USER for users, ROLE_ADMIN for admins, or ROLE_USER | ROLE_ADMIN if user has both roles
// );
// ROLE_USER and ROLE_ADMIN are constants defined in inc/common.php
// returns null if such user is not found
function getUser($userid) {
global $_TABLES;
$u = null;
if ($userid) {
$u['id']=$userid;
$u['login'] = DB_getItem($_TABLES['users'],"username","uid=".$userid);
$u['roles'] = $GLOBALS['fc_config']['liveSupportMode']?ROLE_CUSTOMER:ROLE_USER;
$array = explode(",",SEC_getUserPermissions('',$userid));
foreach($array as $k => $v){
if($v == 'user.edit'){
$u['roles'] = ROLE_ADMIN;
break;
}
}
return $u;
}
return null;
}
function getUsers() {
global $_TABLES;
$stmt = new Statement("SELECT uid as id, username as login FROM ".$_TABLES['users']);
return $stmt->process();
}
// returns URL of user profile page for such user id or null if user not found
function getUserProfile($userid) {
if($userid == SPY_USERID) return null;
global $_CONF;
return $_CONF['site_url'] . "/users.php?mode=profile&uid=$userid";
}
// checks user role
function userInRole($userid, $role) {
if($user = $this->getUser($userid)) {
return ($user['roles'] == $role);
}
return false;
}
function getGender($userid) {
// 'M' for Male, 'F' for Female, NULL for undefined
return NULL;
}
}
$GLOBALS['fc_config']['db'] = array(
'host' => $_DB_host,
'user' => $_DB_user,
'pass' => $_DB_pass,
'base' => $_DB_name,
'pref' => $_DB_table_prefix . 'fc_'
);
foreach($GLOBALS['fc_config']['languages'] as $k => $v) {
$GLOBALS['fc_config']['languages'][$k]['dialog']['login']['moderator'] = '';
}
$GLOBALS['fc_config']['cms'] = new GeekLogCMS();
?>
14
11
Quote
All times are EST. The time is now 08:57 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content