- Code: Select all
require_once "src/phpfreechat.class.php";
$params['serverid'] = md5(__FILE__);
if( isset($_GET['x']) && $_GET['x']=='y' ){
$params["nick"] = 'admin' . rand(1, 10);
$params["isadmin"] = true;
}else{
$params["nick"] = 'guest' . rand(1, 100);
$params["isadmin"] = false;
}
$chat = new phpFreeChat($params);
the 'nick' is set correctly, but the 'isadmin' is not.
if the admin is the first in the chat (by way of ?x=y), he and everybody else that come later (guests - directly on index.php) are made admins.
if a guest is first in the chat (directly on index.php), he and everybody else (including admins - index.php?x=y) have isadmin=false and are not admins.
after each test, i deleted the cookies from browsers (from different machines), closed the browsers, and deleted the cache from server (/private/chache, chat, logs; /public/themes/).
it seems that isadmin is a chat property and set up on first visit, not a visitor property and not set up on case by case.
is this a bug, or am i doing something wrong?
so, i want to set up 'isadmin' based on some conditions, and i do not want to use 'admins' and /identify.
can anyone help me?
thank you in advance.
and btw, this is an awesome project.