It appears you have not yet registered with our community. To register please click here...

vbulletin-skins-forum
| Discussions: 2,538 | Messages: 7,331 | Members: 8,237 | Online: 21 | Newest : AllenDHA (Welcome!)
Logo
All times are GMT -5. The time now is 05:39 AM.

Go Back   Forums Help - vBulletin, IPB, phpBB, SMF skins and community > Forum Areas > vBulletin Area > VB Technical Talk

VB Technical Talk The place to talk about vBulletin technical stuff

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 06-23-2008, 12:13 PM   #1 (permalink)
User Profile
cinneke
Junior Member
 

Join Date: Jun 2008
Age: 36
Posts: 1
Total Points: 130
Donate
My Photos: (0)
Not fixed problem flashchat

Hi i have an problem i have install the chat but only me the admin cant login (and not login on the normal chat )i get the message :

Could not grant admin role for this login and password

i have look at this forum for solution but not find it .
ps i have all the usergroups in vb installed

topic is here :




see the code from intergration: file :

<?php
/*
$Author: pem $
$Revision: 3.5 $
$Date: 2008/05/06 00:44:20 $

Written By Paul Marsden.

This CMS file is for Flashchat integration with vBulletin 3.7
This version uses Usergroup Integration and is supplied as part of my Integration Modification at vbulletin.org.
*/

// Path override for vbulletin root folder //
$vbpath = ''; // This should not normally be changed. //

// Main Class //
class vBulletinCMS
{
// Initialise CMS //
function vBulletinCMS()
{
$prefix = $GLOBALS['vbulletin']['prefix'];
$this->loginStmt = new Statement("SELECT *, userid AS id FROM {$prefix}user WHERE username=?");
$this->getUserStmt = new Statement("SELECT *, userid AS id, username AS login FROM {$prefix}user WHERE userid=?");
$this->getUsersStmt = new Statement("SELECT *, userid AS id, username AS login FROM {$prefix}user");
$this->getUserForSession = new Statement("SELECT * FROM {$prefix}session WHERE sessionhash=? ORDER BY lastactivity DESC");
$this->updateLastactivityForUser = new Statement("UPDATE {$prefix}user SET lastactivity=? WHERE userid=?");
$this->updateSessionForUser = new Statement("UPDATE {$prefix}session SET lastactivity=?, location='$_SERVER[REQUEST_URI]' WHERE userid=?");
$this->getAvatar = new Statement("SELECT * FROM {$prefix}customavatar WHERE userid = ? AND visible = 1");
$this->getPicture = new Statement("SELECT * FROM {$prefix}customprofilepic WHERE userid = ? AND visible = 1");
$this->getUserGroup = new Statement("SELECT * FROM {$prefix}usergroup WHERE usergroupid=?");

$this->session = $_COOKIE[$GLOBALS['vbulletin']['cookie'] . 'sessionhash'];
if($_SESSION['fc_users_cache']['sessionhashid'] != $this->session)
{
$rs = $this->getUserForSession->process($this->session);
if($rec = $rs->next())
{
$this->userid = intval($rec['userid']);
$_SESSION['fc_users_cache']['sessionuserid'] = $this->userid;
$_SESSION['fc_users_cache']['sessionhashid'] = $this->session;
}
}
else
{
$this->userid = $_SESSION['fc_users_cache']['sessionuserid'];
}

if($_POST['t'] AND $GLOBALS['vbulletin']['spkupdate'] AND intval($this->userid) > 0)
{
$ru = $this->updateSessionForUser->process(time(),$this->userid);
$ru = $this->updateLastactivityForUser->process(time(),$this->userid);
}
}

// Auto Login //
function isLoggedIn()
{
$userid = $this->userid;
if($userid > 0)
{
unset ($_SESSION['fc_users_cache'][$userid]);
unset ($_SESSION['fc_roles_cache'][$userid]);
if($GLOBALS['vbulletin']['logupdate'])
{
$ru = $this->updateSessionForUser->process(time(),$userid);
$ru = $this->updateLastactivityForUser->process(time(),$userid);
}
}
return $userid;
}

// Manual Login //
function login($login, $password)
{
$rv = NULL;
if ($login == '_int_') return $this->userid;
if($GLOBALS['fc_config']['loginUTF8decode'])
{
$login = utf8_to_entities($login);
$rs = $this->loginStmt->process(utf8_decode($login));
}
else
{
$rs = $this->loginStmt->process($login);
}
$rec = $rs->next();
if($rs)
{
if($GLOBALS['fc_config']['loginUTF8decode'])
{
$password = utf8_to_entities($password);
if(($rec['password'] == md5(md5(utf8_decode($password)) . $rec['salt']))) $userid = $rec['id'];
}
else
{
if(($rec['password'] == md5(md5($password) . $rec['salt']))) $userid = $rec['id'];
}
}
if($userid > 0)
{
unset ($_SESSION['fc_users_cache'][$userid]);
unset ($_SESSION['fc_roles_cache'][$userid]);
if($GLOBALS['vbulletin']['logupdate'])
{
$ru = $this->updateSessionForUser->process(time(),$userid);
$ru = $this->updateLastactivityForUser->process(time(),$userid);
}
}
return $userid;
}

// Logout //
function logout()
{
$_SESSION['fc_users_cache']['sessionhashid'] = 'Log-Out';
if($this->userid > 0 AND $GLOBALS['vbulletin']['logupdate'])
{
$ru = $this->updateSessionForUser->process(time(),$this->userid);
$ru = $this->updateLastactivityForUser->process(time(),$this->userid);
}
return NULL;
}

// Assign chat role //
function getRoles($usergroupid)
{
$groups = explode(',',$usergroupid);
$userrole = ROLE_ANY ; // Preset Default - Should never actually be needed //
foreach ($GLOBALS['vbulletin']['noaccess'] as $group) if (in_array($group,$groups)) $userrole = ROLE_ANY;
foreach ($GLOBALS['vbulletin']['users'] as $group) if (in_array($group,$groups)) $userrole = ROLE_USER;
if ($GLOBALS['fc_config']['liveSupportMode'])
{
foreach ($GLOBALS['vbulletin']['customer'] as $group) if (in_array($group,$groups)) $userrole = ROLE_CUSTOMER;
}
foreach ($GLOBALS['vbulletin']['mods'] as $group) if (in_array($group,$groups)) $userrole = ROLE_MODERATOR;
foreach ($GLOBALS['vbulletin']['admin'] as $group) if (in_array($group,$groups)) $userrole = ROLE_ADMIN;
foreach ($GLOBALS['vbulletin']['banned'] as $group) if (in_array($group,$groups)) $userrole = ROLE_NOBODY;
return $userrole;
}

// Get user details //
function getUser($userid)
{
if(($rs = $this->getUserStmt->process($userid)) && ($rec = $rs->next()))
{
if(intval($rec['membergroupids'])) $rec['usergroupid'] .= ",".$rec['membergroupids'] ;
$permlist = array('users','customer','mods','admin','banned',' noaccess');
foreach($permlist as $permission) $GLOBALS['vbulletin'][$permission] = array();
$groups = explode(',',$rec['usergroupid']);
foreach($groups as $group)
{
if(($rx = $this->getUserGroup->process($group)) && ($rex = $rx->next()))
{
if(intval($rex['fcpermissions']))
{
$bit = 1;
foreach($permlist as $permission)
{
if ($rex['fcpermissions'] & $bit) $GLOBALS['vbulletin'][$permission][] = $group;
$bit *= 2;
}
}
else
{
exit('vBulletin 3.7 : Integration Error 03 : No permissions set for usergroup '.$group.'.');
}
}
else
{
exit('vBulletin 3.7 : Integration Error 04 : No permissions found for usergroup '.$group.'.');
}
}
$rec['roles'] = $this->getRoles($rec['usergroupid']);
if($GLOBALS['fc_config']['loginUTF8decode'])
{
$tagencoded = entities_to_utf8($rec['login']);
if(strlen($rec['login']) > strlen($tagencoded)) $rec['login'] = $tagencoded;
else $rec['login'] = utf8_encode($rec['login']);
}
$_SESSION['fc_users_cache'][$userid] = $rec;
$_SESSION['fc_roles_cache'][$userid] = $rec['roles'];
return $rec;
}
return null;
}

// Return all existing users //
function getUsers()
{
return $this->getUsersStmt->process();
}

// Returns URL of user profile page //
function getUserProfile($userid)
{
if(($rs = $this->getUserStmt->process($this->userid)) && ($rec = $rs->next()))
{
$fcid = $rec['userid'];
$fcus = sha1($rec['salt']);
}
else
{
exit('vBulletin 3.7 : Integration Error 06 : Unable to load user information.');
}
return ($this->userid == $userid) ? "../profile.php?do=editprofile&fcid=$fcid&fcus=$fcus" : "../member.php?u=$userid&fcid=$fcid&fcus=$fcus";
}

// Check if user is in role //
function userInRole($userid, $role)
{
if(!intval($userid))
{
return false;
}
$user = $this->getUser($userid) ;
if($role == $user['roles']) return true;
return false;
}

// Get Male or Female //
function getGender($user)
{
return NULL;
}

// Get current profile picture or avatar //
// This function only works if you use the database storage method in vbulletin //
function getPhoto($userid)
{
if($_SESSION['fc_users_cache'][$userid]['pid'] == $userid)
{
return $_SESSION['fc_users_cache'][$userid]['fpath'];
}
if($GLOBALS['vbulletin']['useavatar'])
{
$rs = $this->getAvatar->process($userid);
}
else
{
$rs = $this->getPicture->process($userid);
}
$rec = $rs->next();
if($rec['filedata'] == '') return '';
$fparts = explode('.', $rec['filename']);
$fextn = $fparts[count($fparts)-1];
$fname = '$'.substr('000000'.$userid,-6).'$'.$rec['dateline'];
$fpath = './images/cust_img/'.$fname.'.'.$fextn;
if(!file_exists($fpath))
{
$fp = fopen($fpath, 'wb');
fwrite($fp, $rec['filedata']);
fflush($fp);
fclose($fp);
}
$_SESSION['fc_users_cache'][$userid]['pid'] = $userid;
$_SESSION['fc_users_cache'][$userid]['fpath'] = $fpath;
return $fpath;
}
}

// Security check //
if (!defined('INC_DIR'))
{
exit('vBulletin 3.7 : Integration Error 01 : Please consult you system administrator.');
}

// Find vbroot //
if ($vbpath)
{
$vbroot = $vbpath;
}
else
{
$vbroot = realpath(dirname(__FILE__)).'/../../../';
}

// Get vb config //
if (!include_once($vbroot.'includes/config.php'))
{
exit('vBulletin 3.7 : Integration Error 02 : Unable to load the vBulletin config file.');
}

// Clear the moderator login message //
foreach($GLOBALS['fc_config']['languages'] as $k => $v)
{
$GLOBALS['fc_config']['languages'][$k]['dialog']['login']['moderator'] = '';
}

// Get vbulletin config settings //
$GLOBALS['fc_config']['db'] = array(
'base' => $config['Database']['dbname'],
'user' => $config['MasterServer']['username'],
'pass' => $config['MasterServer']['password'],
'pref' => $GLOBALS['fc_config']['db']['pref'],
'host' => $config['MasterServer']['servername'],
);

// Add tcp port if specified //
if($config['MasterServer']['port'])
{
$GLOBALS['fc_config']['db']['host'] .= ':'.$config['MasterServer']['port'];
}

$GLOBALS['vbulletin'] = array(
/*
# vBulletin specific settings #
Do not alter these unless you understand them.
spkupdate = Update vBulletin session when user speaks
logupdate = Update vBulletin session when user logs in/out.
useavatar = Use Custom avatar (true) or use Custom profile picture (false).
*/
'spkupdate' => true, 'logupdate' => true, 'useavatar' => true,

// Do not touch these, you will probably break something //
'cookie' => $config['Misc']['cookieprefix'], 'prefix' => $config['Database']['tableprefix']
);

// Initiate CMS //
$GLOBALS['fc_config']['cms'] = new vBulletinCMS();

?>

Last edited by cinneke : 06-23-2008 at 12:19 PM.
cinneke is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Points Per Thread View: 1
Points Per Thread: 15
Points Per Reply: 5


Similar Threads
Thread Thread Starter Forum Replies Last Post
IE new user subscription problem els VB Forum Management 0 01-19-2008 09:16 AM
strange problem with rss feed icon plugin BotMan vBulletin News Feeds 0 06-09-2007 02:41 PM
big problem :S H!tm@N VB Technical Talk 10 04-26-2007 04:45 PM
Problem when importing database BotMan vBulletin News Feeds 0 01-05-2007 10:22 AM
Problem with Firefox.. Mike Members Support 4 12-24-2006 10:31 AM


Links: Babyforum.com | Deejayforum.com | Hometalkcafe.com | Equineboard.com | Evboard.com


Forums Help: Forum Skin Design and Professional Services RSS Feeds



Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
Forums Help - All Rights Reserved