Файл: _gladiators2_/gladiators2/gladiators/gladiators/chat/re.php
Строк: 109
<?
session_start($sid);
include("../includes/std.h.php");
include("../includes/skitalec.php");
echo"<html>
<head>
<meta content='text/html; charset=windows-1251' http-equiv='Content-type'>
</head>
<body>";
if(!$_SESSION["id"])
echo"<script language=javascript>top.window.location='../index.php';</script>";
elseif(check_block($_SESSION["login"]))
echo"<script language=javascript>top.window.location='/enter.php?act=out';</script>";
$date = Date("Ymd");
if(!session_is_registered("chat_id") || $_SESSION["room"]!=$_SESSION["prev_room"])
{
$file = "date/".$_SESSION["room"]."/".$date.".dat";
session_register('chat_id');
if(!file_exists($file))
touch($file);
$count = count(file($file))-1;
$chat_id = $count;
}
if(!session_is_registered("private_id"))
{
$file = "date/private/".$date.".dat";
session_register('private_id');
if(!file_exists($file))
touch($file);
$count = count(file($file))-1;
$private_id = $count;
}
if($_GET["text"])
{
$_GET["text"] = htmlspecialchars($_GET[text]);
$_GET["text"] = str_replace("'",'"',$_GET[text]);
$gag = check_muzz($_SESSION["login"]);
if($gag)
exit();
$_GET["text"] = string_cut($_GET["text"],40);
if(strstr($_GET["text"],"private ("))
{
$file = fopen("date/private/".$date.".dat", "a+");
fwrite($file,"|".Date("H:i")."|".$_SESSION["login"]."|".$_GET["text"]."|".$_SESSION["ch_color"]."|n");
fclose($file);
}
else
{
$file = fopen("date/".$_SESSION["room"]."/".$date.".dat", "a+");
fwrite($file,"|".Date("H:i")."|".$_SESSION["login"]."|".$_GET["text"]."|".$_SESSION["ch_color"]."|n");
fclose($file);
}
$_GET["text"] = skitalec($_GET["text"]); // Подключение бота(Скиталец)
echo"<script language=javascript>top.clear_text();</script>n";
}
echo"<script language=javascript>";
if(!file_exists("date/".$_SESSION["room"]."/".$date.".dat"))
touch("date/".$_SESSION["room"]."/".$date.".dat");
$array_chat = file("date/".$_SESSION["room"]."/".$date.".dat");
$count_chat = count($array_chat);
for($i=($_SESSION["chat_id"]+1);$i<=($count_chat-1);$i++)
{
$row_chat = explode("|",$array_chat[$i]);
if(!$row_chat[2])
{
$row_chat[1] = str_replace($row_chat[1], "<small style="color:#ffffff;border:solid 1pt #5d5b50;background-color:#8b8c77;font-weight:bold">$row_chat[1]</small>", $row_chat[1]);
$string .= " <small>".$row_chat[1]."</small> <span style="color:".$row_chat[4].""> ".$row_chat[3]."</span><br>";
}
else
{
if(strstr($row_chat[3],"=> (".$_SESSION["login"].")"))
$string .= " <small style="color:#ffffff;border:solid 1pt #5d5b50;background-color:#8b8c77;">".$row_chat[1]."</small>";
else
$string .= " <small style="color:#62665c">".$row_chat[1]."</small>";
$row_chat[3] = str_replace("=> (".$_SESSION["login"].")", "<a href='javascript:top.SayTo("$row_chat[2]");'>=> <b>(<span>".$_SESSION["login"]."</span>)</b></a>", $row_chat[3]);
$string .= " <a href="javascript:top.SayTo('".$row_chat[2]."');">(<span style='font-weight:bold'>".$row_chat[2]."</span>)</a> <font color=".$row_chat[4]."> ".$row_chat[3]."</font><br>";
}
}
$chat_id = $count_chat-1;
if(!file_exists("date/private/".$date.".dat"))
touch("date/private/".$date.".dat");
$private_array = file("date/private/".$date.".dat");
$private_count = count($private_array);
for($i=($_SESSION["private_id"]+1);$i<=$private_count-1;$i++)
{
$row_private = explode("|",$private_array[$i]);
if(strstr($row_private[3], "private (".$_SESSION["login"].")") || $row_private[2]==$_SESSION["login"] || $_SESSION["login"]=="Император")
{
$row_private[1] = str_replace($row_private[1], "<small style="color:#ffffff;border:solid 1pt #5d5b50;background-color:#8b8c77;font-weight:bold">$row_private[1]</small>", $row_private[1]);
$row_private[3] = str_replace("private (".$_SESSION["login"].")", "<a href='javascript:top.PrivateSayTo("$row_private[2]");'><b>private (<span>".$_SESSION["login"]."</span>)</b></a>", $row_private[3]);
$row_private[3] = str_replace("=> (".$_SESSION["login"].")", "<a href='javascript:top.SayTo("$row_private[2]");'>=> <b>(<span>".$_SESSION["login"]."</span>)</b></a>", $row_private[3]);
$string .= " <small style="color:#DC143C">".$row_private[1]."</small> <a href="javascript:top.SayTo('".$row_private[2]."');">(<b><span>".$row_private[2]."</span></b>)</a> <font color=".$row_private[4]."> ".$row_private[3]."</font><br>";
}
}
$private_id = $private_count-1;
$sys_array = file("date/system/system.dat");
$sys_count = count($sys_array);
$find = 0;
for($i=0;$i<=$sys_count-1;$i++)
{
$row_sys = explode("|",$sys_array[$i]);
if($row_sys[1]==$_SESSION["login"])
{
$find = 1;
unset($sys_array[$i]);
$string .= " <small style=color:#62665c;>".$row_sys[0]."</small><font color=#000000> (<b style=color:darkred;>system</b>) ".$row_sys[2]."</font><br>";
}
}
if($find)
{
$fp = fopen("date/system/system.dat","w");
flock($fp,2);
fwrite($fp,implode("",$sys_array));
flock($fp,3);
fclose($fp);
}
echo"top.frames['chat'].text('".$string."');</script>";
?>