SuperBruger
Tja, jeg vil lave nogle SuperBruger til min TinyChat....sådan ser script det DATABASEN ud:<?
/*
TinyChat V1.00 - A simple web based chat written in PHP
Copyright (C) 2000 Thomas Lesvang (tl@coolchat.dk)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
<?
require(\"configuration.php\");
mysql_connect($host, $database, $dbpass );
mysql_select_db($dbuser);
class HexChat
{
function register()
{
$nar = func_num_args();
if( $nar != 2 )
return 0;
$args = func_get_args();
$result = MYSQL_QUERY(\"SELECT * FROM tinychat_user WHERE user_name=\'$args[0]\' AND user_pass=\'$args[1]\'\");
if( ($num = mysql_numrows($result)) == 1 )
return 0;
if( !MYSQL_QUERY(\"INSERT INTO tinychat_user (user_name, user_pass, user_status, user_textcol, user_namecol)
VALUES(\'$args[0]\', \'$args[1]\', 1, \'\".$GLOBALS[\"text_color\"].\"\',\'\".$GLOBALS[\"text_color\"].\"\')\") )
return 0;
return 1;
}
function logmsg($logfile, $msg)
{
$logf = fopen(\"logs/$logfile\", \"a\");
fputs($logf, date(\"d/m - H:i : \"));
fputs($logf, \"$msg\\n\");
fclose($logf);
}
function login($username, $password)
{
MYSQL_QUERY(\"DELETE FROM tinychat_postmsg WHERE seton+1800>\".time());
MYSQL_QUERY(\"DELETE FROM tinychat_ban WHERE ban_expire<\".time());
$result = MYSQL_QUERY(\"SELECT * FROM tinychat_user WHERE user_name=\'$username\' AND user_pass=\'$password\'\");
if( ($num = mysql_numrows($result)) == 0 )
return 0;
if( ($user_status = mysql_result($result,0,\"user_status\")) == 1 )
{
$resultb = MYSQL_QUERY(\"SELECT * FROM tinychat_ban WHERE ban_ip=\'\".$GLOBALS[\"REMOTE_ADDR\"].\"\'\");
if( ($numb = mysql_numrows($resultb)) > 0 )
return -1;
}
$user_id = mysql_result($result,0,\"user_id\");
$user_textcol = mysql_result($result,0,\"user_textcol\");
$user_namecol = mysql_result($result,0,\"user_namecol\");
MYSQL_QUERY(\"UPDATE tinychat_user SET user_lastlogin=\".time().\", user_lastip=\'\".$GLOBALS[\"REMOTE_ADDR\"].\"\' WHERE user_id=$user_id\");
$keys[0] = $user_id;
$keys[1] = time().\"KEY\";
$userfile = fopen(\"data/user$user_id\", \"w\");
fputs($userfile, time().\"\\n\");
fputs($userfile, $keys[1].\"\\n\");
fputs($userfile, $user_status.\"\\n\");
fputs($userfile, $user_textcol.\"\\n\");
fputs($userfile, $user_namecol.\"\\n\");
fputs($userfile, $username.\"\\n\");
fputs($userfile, $GLOBALS[\"REMOTE_ADDR\"].\"\\n\");
fclose($userfile);
$login_msg = $username.$GLOBALS[\"CONF_LoginMsg\"].date(\"H:i\");
if( ($fp=@fopen(\"data/globalmsg\", \"r\")) )
{
if( !file_exists(\"data/msg$user_id\") )
{
$this->write_system($login_msg);
$msgfile = fread($fp, 8192);
fclose($fp);
if( ($fp=@fopen(\"data/msg$user_id\", \"w\")) )
{
fputs($fp, $msgfile);
fclose($fp);
}
}
}
$this->logmsg(\"login.log\", $login_msg);
return $keys;
}
function validate_user($userid, $userkey)
{
$userfile = @file(\"data/user$userid\");
if( (chop($userfile[1])) != $userkey )
return 0;
MYSQL_QUERY(\"UPDATE tinychat_user SET user_lastcontact=\".time().\" WHERE user_id=$userid\");
if( chop($userfile[2]) == 1 ) $myuser = new HexChatNormalUser($userid, $userkey, chop($userfile[3]), chop($userfile[4]), chop($userfile[5]), chop($userfile[2]));
if( chop($userfile[2]) == 2 ) $myuser = new HexChatCoAdminUser($userid, $userkey, chop($userfile[3]), chop($userfile[4]), chop($userfile[5]), chop($userfile[2]));
if( chop($userfile[2]) == 3 ) $myuser = new HexChatAdminUser($userid, $userkey, chop($userfile[3]), chop($userfile[4]), chop($userfile[5]), chop($userfile[2]));
return $myuser;
}
function change_nick($user, $nick)
{
$msg = \"<b>\".$user->username.\"</b>\".$GLOBALS[\"CONF_NickChange\"].\"<b>$nick</b>\";
$user->username = $nick;
$this->update_user($user);
$this->write_system($msg);
}
function change_namecolor($user, $color)
{
$msg = \"<b>\".$user->username.\"</b>\".$GLOBALS[\"CONF_NameColorChange\"].\"<b>$color</b>\";
$user->namecol = $color;
$this->update_user($user);
$this->write_private_system($msg, $user->username, $user->userid);
}
function change_textcolor($user, $color)
{
$msg = \"<b>\".$user->username.\"</b>\".$GLOBALS[\"CONF_TextColorChange\"].\"<b>$color</b>\";
$user->textcol = $color;
$this->update_user($user);
$this->write_private_system($msg, $user->username, $user->userid);
}
function update_user($user)
{
$userfile = fopen(\"data/user\".$user->userid, \"w\");
fputs($userfile, time().\"\\n\");
fputs($userfile, $user->userkey.\"\\n\");
fputs($userfile, $user->status.\"\\n\");
fputs($userfile, $user->textcol.\"\\n\");
fputs($userfile, $user->namecol.\"\\n\");
fputs($userfile, $user->username.\"\\n\");
fputs($userfile, $GLOBALS[\"REMOTE_ADDR\"].\"\\n\");
fclose($userfile);
}
function logout($userid, $username)
{
$logout_msg = $username.$GLOBALS[\"CONF_LogoutMsg\"].date(\"H:i\");
$this->write_system($logout_msg);
MYSQL_QUERY(\"UPDATE tinychat_user SET user_lastcontact=0 WHERE user_id=\".$userid);
unlink(\"data/msg$userid\");
unlink(\"data/user$userid\");
}
function change_topic($topic)
{
if( ($fp=@fopen(\"data/topic\", \"w\")) )
{
fputs($fp, $topic);
fclose($fp);
}
}
function specialmsg($msg)
{
if( strlen($msg) > 384 ) $msg = substr($msg, 0, 384);
$orilen = strlen($msg);
$msg = ereg_replace(\"http://([a-zA-Z0-9@:%_.~#-\\?&]*)\", \"<a target=_blank href=\\\"http://\\\\1\\\">\\\\1</a>\", $msg);
$msg = ereg_replace(\"([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+[.]{1}[a-zA-Z0-9._-]+)\",\"<a href=\\\"mailto:\\\\1\\\">\\\\1</a>\",$msg);
if( strlen($msg) == $orilen )
{
$msg = ereg_replace(\"\\|([^+]+)\\|\", \"<b>\\\\1</b>\", $msg);
$msg = ereg_replace(\"_([^+]+)_\", \"<i>\\\\1</i>\", $msg);
}
return $msg;
}
function write_public($msg, $ncol, $tcol, $uname)
{
$msg = $this->specialmsg($msg); $besked = \"<font color=#\".$ncol.\"><b>\".$uname.\" : </b></font>\";
if( strcasecmp($tcol,$GLOBALS[\"text_color\"]) )
$besked .= \"<font color=#\".$tcol.\">\".$msg.\"</font><br>\\n\";
else
$besked .= \"$msg<br>\\n\";
$this->logmsg(\"message.log\", $besked);
$message = @file(\"data/globalmsg\");
if( ($fp=@fopen(\"data/globalmsg\", \"w\")) )
{
fputs($fp, $besked);
for ( $i=0 ; $i<25-1 ; $i++ )
fputs($fp, $message[$i]);
fclose($fp);
}
$result = MYSQL_QUERY(\"SELECT user_id, user_name FROM tinychat_user WHERE user_lastcontact+300>\".time());
if( ($num = mysql_numrows($result)) < 1 )
return;
$i=0;
while( $i < $num )
{
$user_id = mysql_result($result, $i,\"user_id\");
$message = @file(\"data/msg$user_id\");
if( ($fp=@fopen(\"data/msg$user_id\", \"w\")) )
{
fputs($fp, $besked);
for ( $j=0 ; $j<25-1 ; $j++ )
fputs($fp, $message[$j]);
fclose($fp);
}
$i++;
}
}
function write_public_action($msg, $uname)
{
$besked = \"<font color=#\".$GLOBALS[\"action_color\"].\"><i>\".$uname.\" $msg</i></font><br>\\n\";
$this->logmsg(\"message.log\", $besked);
$message = @file(\"data/globalmsg\");
if( ($fp=@fopen(\"data/globalmsg\", \"w\")) )
{
fputs($fp, $besked);
for ( $i=0 ; $i<25-1 ; $i++ )
fputs($fp, $message[$i]);
fclose($fp);
}
$result = MYSQL_QUERY(\"SELECT user_id, user_name FROM tinychat_user WHERE user_lastcontact+300>\".time());
if( ($num = mysql_numrows($result)) < 1 )
return;
$i=0;
while( $i < $num )
{
$user_id = mysql_result($result, $i,\"user_id\");
$message = @file(\"data/msg$user_id\");
if( ($fp=@fopen(\"data/msg$user_id\", \"w\")) )
{
fputs($fp, $besked);
for ( $j=0 ; $j<25-1 ; $j++ )
fputs($fp, $message[$j]);
fclose($fp);
}
$i++;
}
}
function kick_user($myuser, $to)
{
$userfile = @file(\"data/user$to\");
if( chop($userfile[2]) >= $myuser->status )
return $GLOBALS[\"ERROR_StatusTooLow\"];
@MYSQL_QUERY(\"UPDATE tinychat_user SET user_lastcontact=0 WHERE user_id=\".$to);
@unlink(\"data/msg$to\");
@unlink(\"data/user$to\");
$km = \"Du er blevet sparket ;-( : <b>\".chop($userfile[5]).\"</b>\";
if( $myuser->status == 3 )
$message = $GLOBALS[\"CONF_KickMsg\"].\"<b>\".$GLOBALS[\"systemname\"].\"</b>...\";
else
$message = $GLOBALS[\"CONF_KickMsg\"].\"<b>\".$myuser->username.\"</b>...\";
$this->logmsg(\"admin.log\", $myuser->username.\" kicked \".chop($userfile[5]));
@MYSQL_QUERY(\"INSERT INTO tinychat_postmsg VALUES(\'\', \'\".chop($userfile[1]).\"\', \'$message\', \".time().\")\");
return $km;
}
function ban_user($myuser, $to, $expire)
{
$userfile = @file(\"data/user$to\");
if( chop($userfile[2]) >= $myuser->status )
return $GLOBALS[\"ERROR_StatusTooLow\"];
@MYSQL_QUERY(\"UPDATE tinychat_user SET user_lastcontact=0 WHERE user_id=\".$to);
@unlink(\"data/msg$to\");
@unlink(\"data/user$to\");
$km = \"Du er blevet banned ;-( : <b>\".chop($userfile[5]).\"</b>\";
if( $myuser->status == 3 )
$message = $GLOBALS[\"CONF_BanMsg\"].\"<b>\".$GLOBALS[\"systemname\"].\"</b>...\";
else
$message = $GLOBALS[\"CONF_BanMsg\"].\"<b>\".$myuser->username.\"</b>...\";
$this->logmsg(\"admin.log\", $myuser->username.\" banned \".$chop($userfile[5]));
@MYSQL_QUERY(\"INSERT INTO tinychat_postmsg VALUES(\'\', \'\".chop($userfile[1]).\"\', \'$message\', \".time().\")\");
@MYSQL_QUERY(\"INSERT INTO tinychat_ban (ban_ip, ban_expire) VALUES(\'\".chop($userfile[6]).\"\',$expire)\");
return $km;
}
function get_postmsg($userkey)
{
$result = MYSQL_QUERY(\"SELECT * FROM tinychat_postmsg WHERE userkey=\'$userkey\'\");
if( ($num = mysql_numrows($result)) == 0 )
return $GLOBALS[\"ERROR_NotLoggedIn\"];
return stripslashes(mysql_result($result,0,\"usermsg\"));
}
function write_private($msg, $uname, $from, $to)
{
$msg = $this->specialmsg($msg);
$result = MYSQL_QUERY(\"SELECT user_name FROM tinychat_user WHERE user_id=$to\");
if( ($num = mysql_numrows($result)) < 1 )
return;
$toname = mysql_result($result, 0, \"user_name\");
$besked = \"<font color=#\".$GLOBALS[\"private_color\"].\"><b>\".$uname.\" (\".$GLOBALS[\"CONF_ToName\"].\" $toname) : </b>\";
$besked .= \"$msg</font><br>\\n\";
$message = @file(\"data/msg$from\");
if( ($fp=@fopen(\"data/msg$from\", \"w\")) )
{
fputs($fp, $besked);
for ( $j=0 ; $j<25-1 ; $j++ )
fputs($fp, $message[$j]);
fclose($fp);
}
$message = @file(\"data/msg$to\");
if( ($fp=@fopen(\"data/msg$to\", \"w\")) )
{
fputs($fp, $besked);
for ( $j=0 ; $j<25-1 ; $j++ )
fputs($fp, $message[$j]);
fclose($fp);
}
}
function write_private_system($msg, $uname, $from)
{
$besked = \"<font color=#\".$GLOBALS[\"private_color\"].\"><b>\".$GLOBALS[\"systemname\"].\" (\".$GLOBALS[\"CONF_ToName\"].\" $uname) : </b>\";
$besked .= \"$msg</font><br>\\n\";
$message = @file(\"data/msg$from\");
if( ($fp=@fopen(\"data/msg$from\", \"w\")) )
{
fputs($fp, $besked);
for ( $j=0 ; $j<25-1 ; $j++ )
fputs($fp, $message[$j]);
fclose($fp);
}
}
function write_system($msg)
{
$this->write_public($msg, $GLOBALS[\"system_color\"], $GLOBALS[\"system_color\"], $GLOBALS[\"systemname\"]);
}
function cleanup()
{
$result = MYSQL_QUERY(\"SELECT user_id, user_name FROM tinychat_user WHERE user_lastcontact+300<\".time().\" AND user_lastcontact!= 0\");
if( ($num = mysql_numrows($result)) == 0 )
return;
$i=0;
while( $i < $num )
{
$user_id = mysql_result($result,$i,\"user_id\");
$user_name = mysql_result($result,$i,\"user_name\");
$this->logout($user_id, $user_name);
$i++;
}
}
function display_error($errormsg)
{
echo $HTTP_POST_VARS[errormsg];
}
}
class HexChatNormalUser
{
var $userid;
var $userkey;
var $namecol;
var $textcol;
var $username;
var $status;
function HexChatNormalUser($usid, $uskey, $tcol, $ncol, $uname, $ustat)
{
$this->userid = $usid;
$this->namecol = $ncol;
$this->textcol = $tcol;
$this->username = $uname;
$this->userkey = $uskey;
$this->status = $ustat;
}
function docommand($mychat, $msg, $to)
{
if( $this->basiccommands($mychat, $msg, $to) )
return 1;
return 0;
}
function basiccommands($mychat, $msg, $to)
{
if( (strpos($msg, \"me\", 0) == 1) and $msg[0] == \'/\' )
{
$mychat->write_public_action(substr($msg,4), $this->username);
return 1;
}
if( (strpos($msg, \"nick\", 0) == 1) and $msg[0] == \'/\' )
{
if( strlen($msg) > (24+6) ) $msg = substr($msg, 0, (24+6));
$mychat->change_nick($this, substr($msg,6));
return 1;
}
if( (strpos($msg, \"textcolor\", 0) == 1) and $msg[0] == \'/\' )
{
if( strlen($msg) > (8+11) ) $msg = substr($msg, 0, (8+11));
$mychat->change_textcolor($this, substr($msg,11));
return 1;
}
return 0;
}
function write($mychat, $to, $msg)
{
$msg = stripslashes($msg);
$msg = htmlentities($msg);
if( !$this->docommand($mychat, $msg, $to) )
{
if( $to == -1 )
$mychat->write_public($msg, $this->namecol, $this->textcol, $this->username);
else
$mychat->write_private($msg, $this->username, $this->userid, $to);
}
$mychat->cleanup();
$this->top();
}
function topic()
{
echo \"<html><body bgcolor=#\".$GLOBALS[\"topic_background_color\"].\" link=#\".$GLOBALS[\"topic_link_color\"].\" \";
echo \"text=#\".$GLOBALS[\"topic_text_color\"].\" \";
echo \"vlink=#\".$GLOBALS[\"topic_link_color\"].\" alink=#\".$GLOBALS[\"topic_link_color\"].\">\";
echo \"<meta http-equiv=\\\"Refresh\\\" content=\\\"\".$GLOBALS[\"CONF_TopicUpdateSpeed\"].\"; URL=topic.php?ukey=\".$this->userid.\"&skey=\".$this->userkey.\"\\\">\";
echo \"<font face=\\\"Verdena, Tahoma, Arial\\\" size=2 color=#\".$GLOBALS[\"topic_text_color\"].\">\";
@readfile(\"data/topic\");
echo \"</font>\";
echo \"</body></html>\";
}
function logout($mychat)
{
$logout_msg = $this->username.$GLOBALS[\"CONF_LogoutMsg\"].date(\"H:i\");
$mychat->write_system($logout_msg);
MYSQL_QUERY(\"UPDATE tinychat_user SET user_lastcontact=0 WHERE user_id=\".$this->userid);
unlink(\"data/msg\".$this->userid);
unlink(\"data/user\".$this->userid);
$mychat->display_error($GLOBALS[\"CONF_LoggedOut\"]);
}
function bund($mychat)
{
$fp = @fopen(\"templates/bund_normal.tmp\", \"r\");
$file = fread($fp, 8192);
fclose($fp);
$file = eregi_replace(\"USERNAME\", $this->username, $file);
$file = eregi_replace(\"USERID\", $this->userid, $file);
$file = eregi_replace(\"USERKEY\", $this->userkey, $file);
$file = eregi_replace(\"NUMUSERS\", $this->get_numusers(), $file);
$file = eregi_replace(\"USERLIST\", $this->get_userlist(), $file);
echo $file;
$mychat->cleanup();
}
function top()
{
echo \"<html><body bgcolor=#\".$GLOBALS[\"background_color\"].\" link=#\".$GLOBALS[\"link_color\"].\" \";
echo \"text=#\".$GLOBALS[\"text_color\"].\" \";
echo \"vlink=#\".$GLOBALS[\"link_color\"].\" alink=#\".$GLOBALS[\"link_color\"].\">\";
echo \"<meta http-equiv=\\\"Refresh\\\" content=\\\"\".$GLOBALS[\"CONF_MsgUpdateSpeed\"].\"; URL=top.php?ukey=\".$this->userid.\"&skey=\".$this->userkey.\"\\\">\";
echo \"<font face=\\\"Verdena, Tahoma, Arial\\\" size=2 color=#\".$GLOBALS[\"text_color\"].\">\";
@readfile(\"data/msg\".$this->userid.\"\");
echo \"</font>\";
echo \"</body></html>\";
}
function userlist()
{
$result = MYSQL_QUERY(\"SELECT user_id, user_name FROM tinychat_user WHERE user_lastcontact+300>\".time().\" AND user_id!=\".$this->userid);
if( ($num = mysql_numrows($result)) == 0 )
return $users;
$i=0;
while( $i<$num )
{
$user_id = mysql_result($result, $i,\"user_id\");
$user_name = mysql_result($result, $i,\"user_name\");
$users .= \"<option value=$user_id>$user_name\";
$i++;
}
return $users;
}
function get_userlist()
{
$normus = \"<option value=-1>\".$GLOBALS[\"CONF_AllName\"];
$normus .= $this->userlist();
return $normus;
}
function get_numusers()
{
$result = MYSQL_QUERY(\"SELECT user_id FROM tinychat_user WHERE user_lastcontact+300>\".time());
if( ($num = mysql_numrows($result)) == 0 )
return \"0\";
return \"$num\";
}
}
class HexChatCoAdminUser extends HexChatNormalUser
{
function HexChatCoAdminUser($usid, $uskey, $tcol, $ncol, $uname, $ustat)
{
$this->HexChatNormalUser($usid, $uskey, $tcol, $ncol, $uname, $ustat);
}
function bund()
{
$fp = @fopen(\"templates/bund_coadmin.tmp\", \"r\");
$file = fread($fp, 8192);
fclose($fp);
$file = eregi_replace(\"USERNAME\", $this->username, $file);
$file = eregi_replace(\"USERID\", $this->userid, $file);
$file = eregi_replace(\"USERKEY\", $this->userkey, $file);
$file = eregi_replace(\"NUMUSERS\", $this->get_numusers(), $file);
$file = eregi_replace(\"USERLIST\", $this->get_userlist(), $file);
echo $file;
}
function docommand($mychat, $msg, $to)
{
if( $this->basiccommands($mychat, $msg, $to) )
return 1;
if( (strpos($msg, \"topic\", 0) == 1) and $msg[0] == \'/\' )
{
$tm = \"<b>\".$this->username.\"</b> \".$GLOBALS[\"CONF_TopicPubMsg\"].\" <b>\".substr($msg,7).\"</b>\";
$mychat->change_topic(substr($msg, 7));
$mychat->write_system($tm);
return 1;
}
if( (strpos($msg, \"kick\", 0) == 1) and $msg[0] == \'/\' && $to>0 )
{
$mychat->write_private_system($mychat->kick_user($this, $to), $this->username, $this->userid);
return 1;
}
if( (strpos($msg, \"ban\", 0) == 1) and $msg[0] == \'/\' && $to>0 )
{
$mychat->write_private_system($mychat->ban_user($this, $to, time()+120), $this->username, $this->userid);
return 1;
}
return 0;
}
function write($mychat, $to, $msg)
{
$msg = stripslashes($msg);
$msg = htmlentities($msg);
if( !$this->docommand($mychat, $msg, $to) )
{
if( $to == -1 )
$mychat->write_public($msg, $this->namecol, $this->textcol, $this->username);
else
$mychat->write_private($msg, $this->username, $this->userid, $to);
}
$mychat->cleanup();
$this->top();
}
function get_userlist()
{
$normus = \"<option value=-1>\".$GLOBALS[\"CONF_AllName\"];
$normus .= $this->userlist();
return $normus;
}
}
class HexChatAdminUser extends HexChatCoAdminUser
{
function HexChatAdminUser($usid, $uskey, $tcol, $ncol, $uname, $ustat)
{
$this->HexChatNormalUser($usid, $uskey, $tcol, $ncol, $uname, $ustat);
}
function bund()
{
$fp = @fopen(\"templates/bund_admin.tmp\", \"r\");
$file = fread($fp, 8192);
fclose($fp);
$file = eregi_replace(\"USERNAME\", $this->username, $file);
$file = eregi_replace(\"USERID\", $this->userid, $file);
$file = eregi_replace(\"USERKEY\", $this->userkey, $file);
$file = eregi_replace(\"NUMUSERS\", $this->get_numusers(), $file);
$file = eregi_replace(\"USERLIST\", $this->get_userlist(), $file);
echo $file;
}
function docommand($mychat, $msg, $to)
{
if( $this->basiccommands($mychat, $msg, $to) )
return 1;
if( (strpos($msg, \"topic\", 0) == 1) and $msg[0] == \'/\' )
{
$tm = $GLOBALS[\"CONF_TopicPrivMsg\"].\" <b>\".substr($msg,7).\"</b>\";
$mychat->change_topic(substr($msg, 7));
$mychat->write_private_system($tm, $this->username, $this->userid);
return 1;
}
if( (strpos($msg, \"kick\", 0) == 1) and $msg[0] == \'/\' && $to>0 )
{
$mychat->write_private_system($mychat->kick_user($this, $to), $this->username, $this->userid);
return 1;
}
if( (strpos($msg, \"ban\", 0) == 1) and $msg[0] == \'/\' && $to>0 )
{
$mychat->write_private_system($mychat->ban_user($this, $to, time()+900), $this->username, $this->userid);
return 1;
}
if( (strpos($msg, \"namecolor\", 0) == 1) and $msg[0] == \'/\' )
{
if( strlen($msg) > (8+11) ) $msg = substr($msg, 0, (8+11));
$mychat->change_namecolor($this, substr($msg,11));
return 1;
}
return 0;
}
function write($mychat, $to, $msg)
{
$msg = stripslashes($msg);
$msg = htmlentities($msg);
if( !$this->docommand($mychat, $msg, $to) )
{
if( $to == -1 )
$mychat->write_public($msg, $this->namecol, $this->textcol, $this->username);
elseif( $to == -2 )
$mychat->write_system($msg);
else
$mychat->write_private($msg, $this->username, $this->userid, $to);
}
$this->top();
}
function get_userlist()
{
$normus = \"<option value=-1>\".$GLOBALS[\"CONF_AllName\"];
$normus .= \"<option value=-2>\".$GLOBALS[\"CONF_ChatName\"];
$normus .= $this->userlist();
return $normus;
}
}
?>