<?

header("Cache-Control: no-cache");
if ($ver=="wml")header ("Content-type:text/vnd.wap.wml; charset=utf-8");
else header("Content-Type:text/html; charset=UTF-8");

require("inc.php");
$link = connect_db();
list($row, $id, $ps, $fsize1, $fsize2) = check_login($link);
require("version.php");

$us=$row["user"]; 

if($row["level"] < 4) {
if ($ver=="wml"){
echo $xml;
echo $dtd;
echo "<wml>\n";
echo "<card id=\"error\" title=\"Ошибка доступа\">\n";
echo "<p align=\"center\">\n";
}else{
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
echo "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"css/css.css\"/>";
echo "<title>Ошибка доступа</title>";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/></head><body>";
echo "<div align=\"center\">";
}
echo $fsize1;
echo "У вас нет прав доступа!\n";
echo $fsize2;
if ($ver=="wml")echo "</p></card></wml>";
else echo "</div></body></html>";
mysql_close ($link);
exit;
}

require("function/bann-kick.php");

if(!@$go){
if ($ver=="wml"){
echo $xml;
echo $dtd;
echo "<wml>\n";
echo "<head><meta http-equiv=\"Cache-Control\" content=\"no-cache\" forua=\"true\"/></head>\n";
echo "<card id=\"vypnut\" title=\"Пнуть\" >\n";
echo "<p>";    
}else{
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
echo "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"css/css.css\"/>";
echo "<title>Пнуть</title>";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/></head><body>";
echo "<div align=\"left\">";
echo "<form method=\"POST\" action=\"kick.php?go=pni&amp;$ses&amp;rm=$rm&amp;ref=$ref\" name=\"auth\">\n";
}
echo $fsize1;
echo "Кого<br/>\n";
echo $fsize2;
echo "<input name=\"nick\" maxlength=\"15\" value=\"$pnik\" title=\"pnut\"/><br/>\n"; 
echo $fsize1;
echo "На сколько (мин)<br/>\n";
echo $fsize2;
echo "<input name=\"wtime\" maxlength=\"3\" title=\"vremya\" format=\"*N\"/><br/>\n";
echo $fsize1;
echo "За что:<br/>\n";
echo $fsize2;
echo "<input name=\"whykik\" maxlength=\"200\" title=\"whykik\"/><br/>\n";
if ($ver=="wml"){
echo $fsize1;
echo "<anchor title=\"go\">Пнуть<go href=\"kick.php?go=pni&amp;$ses&amp;rm=$rm&amp;ref=$ref\" method=\"post\">\n";
echo "<postfield name=\"nick\" value=\"$(nick)\"/>\n";  
echo "<postfield name=\"wtime\" value=\"$(wtime)\"/>\n";  
echo "<postfield name=\"whykik\" value=\"$(whykik)\"/>\n";
echo "</go></anchor>\n";
echo $fsize2;
echo "<br/>\n";
}else{
echo "<input type=\"submit\" value=\"Пнуть\" name=\"enter\"><br/>\n";
}
if ($ver=="wml")echo "</p></card></wml>\n";
else echo "</div></body></html>\n";
mysql_close ($link);
exit; 
}
if ($ver=="wml"){
echo $xml;
echo $dtd;
echo "<wml>\n";
echo "<head><meta http-equiv=\"Cache-Control\" content=\"no-cache\" forua=\"true\"/></head>\n";
if(!isset($rm)){
if ($row["level"]>6)echo "<card id=\"Ok\" title=\"Ok\" ontimer=\"apanel.php?$ses&amp;ref=$ref\"><timer value=\"10\" />\n";
else echo "<card id=\"Ok\" title=\"Ok\" ontimer=\"mpanel.php?$ses&amp;ref=$ref\"><timer value=\"10\" />\n";
} else {
echo "<card id=\"Ok\" title=\"Ok\" ontimer=\"chat.php?$ses&amp;rm=$rm&amp;ref=$ref\"><timer value=\"10\" />\n";
}
echo "<p align=\"center\">\n";                                                
}else{
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
echo "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"css/css.css\"/>";
echo "<title>Ок</title>";
if(!isset($rm)){
if ($row["level"]>6) echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"2; URL=apanel.php?$ses&amp;ref=$ref\">";
else echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"2; URL=mpanel.php?$ses&amp;ref=$ref\">";
}else{
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"2; URL=chat.php?$ses&amp;rm=$rm&amp;ref=$ref\">";
}
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/></head><body>";
echo "<div align=\"center\">";
}
echo $fsize1;
if($level<$row["level"]){
echo "$pnik успешно выпнут!!<br/>\n";
$totime = $wtime;
$wtime = $wtime * 60 + time();
if (!ctype_digit($pid)) {header("Location: index.php"); die;}
mysql_query ("UPDATE users SET kik = '".$wtime."', whokik = '".$us."', whykik = '".$whykik."' WHERE id = '".$pid."'");  
$adm = @mysql_query ("Select user from users where id='1' LIMIT 1;");
$z = @mysql_fetch_array ($adm);
$administration = $z["user"];
$administration = check($administration);
$rnd = rand(0,99999999);
$today=date ("H:i");
$time = time();
$room = "room".$rm;
$txt = "".$us." выпнул из чата юзера <b>".$pnik."</b> на ".$totime." минут, причина: <b>".$whykik.".</b>";
mysql_query ("Insert into $room set klu4= '".$rnd."', time='".$today."', who='".$administration."', message='".$txt."', id='".$time."', towhom='', hid='0', usid='1', komu=''");

@$fi = fopen("log/pinlist.dat", "a+"); 
$dat = date ("d/m/y");
$vrem = date ("H:i");
$lst = "$us пнул $pnik ($dat|$vrem) Причина: $whykik ($totime min.)\n";
@fwrite($fi, "$lst\n");
@fflush($fi);
@fclose($fi);    
} else { 
$levelselect = @mysql_query ("Select name from levels where level='".$level."'");
$levels = @mysql_fetch_array($levelselect);
$levname = $levels["name"];
echo "С ума сошли ".$levname."a пинать!? $bnik вам это припомнит!\n";
}
echo $fsize2;
mysql_close ($link);
if ($ver=="wml")echo "</p></card></wml>\n";
else echo "</div></body></html>\n";
?>