user);$i++){
if($statusf->user[$i]==$_SESSION['username']){
$userexist=true;
break;
}
if($userexist==true){break;}
}
$i=0;
fwrite($file, ''."\n".''."\n");
$wrote=false;
foreach($statusf as $status){
if(($statusf->user[$i]==$_SESSION['username'])||($userexist==false)){
if($userexist==false){
fwrite($file, ' '.$statusf->user[$i]."\n");
}
if($wrote==false){fwrite($file, ' '.$_SESSION['username']."\n"); $wrote=true;}
} else {
fwrite($file, ' '.$statusf->user[$i]."\n");
}
$i++;
}
fwrite($file, '');
fclose($file);
}
//get users color
if($_SESSION['username']!="guest"){
$userxml=simplexml_load_file("../account_data/".$_SESSION['username'].".xml");
$color=$userxml->color;
} else {
$color="#ffffff";
}
//read file
$get_chat_file=file_get_contents("chat.txt");
//manage text eg image parsing and link parsing ect
$usertext=str_replace(array("<",">"),"",$_POST['text']);
$usertext_split=explode(" ",$usertext);
$usertext="";
foreach($usertext_split as $text){
if(substr($text,0,29)=="https://www.youtube.com/watch"){
$text='
';
}
elseif(substr($text,0,4)=="http"||substr($text,0,5)=="https"){
if(strpos($text,".jpg")||strpos($text,".png")||strpos($text,".gif")){
$text='
';
} else {
$text=''.$text.'';
}
}
if($text=="nigger"){
$text="ERROR. N**** TRIED TO BYPASS";
}
$usertext=$usertext.$text." ";
}
//tags
$tags="";
if($_SESSION['username']=="iceyrazor"){
$tags=$tags.'site owner
';
}
$chatfile=fopen("chat.txt","w");
$chat_file_send_content=$get_chat_file.'
'.$tags.'
'.$_SESSION['username'].'
:
'.$usertext.'
';
//cheak perms and run commands
$bot_tag='site bot
';
$perm_clear=false;
$perm_mute_guest=false;
$perm_mute=false;
$perm_lock_chat=false;
$perm_bypass_lock=false;
foreach($userxml->permissions->perm as $perm){
if($perm=="simplychatty.clear"){ $perm_clear=true; };
if($perm=="simplychatty.mute-guest"){ $perm_mute_guest=true; };
if($perm=="simplychatty.mute"){ $perm_mute=true; };
if($perm=="simplychatty.lock-chat"){ $perm_lock_chat=true; };
if($perm=="simplychatty.bypass-lock"){ $perm_bypass_lock=true; };
}
if($perm_clear==true&$usertext=="/clear "){
$chat_file_send_content='
Welcome To Simply Chatty
';
}
$chatstat=file_get_contents("chatstat.txt");
if($perm_lock_chat==true&$usertext=="/lock chat "){
$file_chatstat=fopen("chatstat.txt","w");
if($chatstat=="locked"){
$chat_file_send_content=$get_chat_file.''.$bot_tag." ".
$_SESSION['username'].' unlocked the chat
';
fwrite($file_chatstat,"unlocked");
} else {
$chat_file_send_content=$get_chat_file.''.$bot_tag." ".
$_SESSION['username'].' locked the chat
';
fwrite($file_chatstat,"locked");
}
fclose($file_chatstat);
}
if($perm_bypass_lock==false&$chatstat=="locked"){
$chat_file_send_content=$get_chat_file."";
}
if(false==true){
//unfinished mute
$chat_file_send_content=$get_chat_file.''.$bot_tag." ".
$_SESSION['username']." muted ".$usertext_split[1].'
';
}
//
fwrite($chatfile,$chat_file_send_content);
fclose($chatfile);
?>