View Full Version : AJAX chat help

11-09-2010, 01:24 AM
I just uploaded ajax chat to my website and working. Just trying to set some features such as admin and password.

The answer is http://sourceforge.net/apps/mediawiki/ajax-chat/index.php?title=Custom_moderators_and_admins, but I'm blunt right now.

So after I added it, it should look like this right?

* @package AJAX_Chat
* @author Sebastian Tschan
* @copyright (c) Sebastian Tschan
* @license GNU Affero General Public License
* @link https://blueimp.net/ajax/

class CustomAJAXChat extends AJAXChat {

// Returns an associative array containing userName, userID and userRole
// Returns null if login is invalid
function getValidLoginUserData() {

$customUsers = $this->getCustomUsers();

if($this->getRequestVar('password')) {
// Check if we have a valid registered user:

$userName = $this->getRequestVar('userName');
$userName = $this->convertEncoding($userName, $this->getConfig('contentEncoding'), $this->getConfig('sourceEncoding'));

$password = $this->getRequestVar('password');
$password = $this->convertEncoding($password, $this->getConfig('contentEncoding'), $this->getConfig('sourceEncoding'));

foreach($customUsers as $key=>$value) {
if(($value['userName'] == $userName) && ($value['password'] == $password)) {
$userData = array();
$userData['userID'] = MyUserID;
$userData['userName'] = $this->trimUserName($value['userName']);
$userData['userRole'] = AJAX_CHAT_MODERATOR;
return $userData;

11-11-2010, 03:45 AM
Anyone here can help me?