<?php
session_start();
include("../inc/func.inc.php");
$maxline=25;
$no_com="1";
function is_banned($user) {
if (file_exists("banned_user/".$user)) {
return 1;
} else {
return 0;
}
}
if($_SESSION['name']=="" or is_banned($_SESSION['name'])){die("login/banned");}
if( isset($_POST['say']) and strlen($_POST['say']) > 1){
$to=0;
$say = parse_text($_POST['say']);
if(substr($say, 0, 5)=="/kick" and $_SESSION['mod']=="1") {
$no_com=0;
$kick = split(" ", $say);
if ($_SESSION['name']!=$kick[1]) {
$dateiname = "banned_user/".$kick[1];
$handler = fOpen($dateiname , "a+");
fWrite($handler , $out);
fClose($handler);
}
}
if(substr($say, 0, 5)=="/free" and $_SESSION['mod']=="1") {
$no_com=0;
$free = split(" ", $say);
if (file_exists("banned_user/".$free[1])) {
unlink("banned_user/".$free[1]);
}
}
if($no_com) {
if (isset($_POST['to']) and strlen($_POST['to'])>2) {
$to = parse_text($_POST['to']);
}
$tim= time();
$new= $tim."][".htmlspecialchars($_SESSION['name'])."][".$_SESSION['color']."][".$say."][".$to."\r\n";
$line= file("db/chat.db");
if(count($line)>$maxline-1) {
unset($line[0]);
}
$out= implode($line);
$out= $out.$new;
$dateiname = "db/chat.db";
unlink($dateiname);
$handler = fOpen($dateiname , "a+");
fWrite($handler , $out);
fClose($handler);
}
}
?>