Файл: _gladiators2_/gladiators2/gladiators/gladiators/online.php
Строк: 257
<?
@session_start();
if( !isset($_SESSION["id"]) )
echo"<script language=JavaScript>top.window.location='../index.php';</script>";
include("system/config/values.php");
?>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=windows-1251">
<link rel=stylesheet type="text/css" href="/css/index.css">
<script language=javascript>
function ch_show(login,level,align,gag,klan) {
var aligns_alt = Array();
aligns_alt["1"] = "Темный";
aligns_alt["2"] = "Светлый";
aligns_alt["3"] = "Нейтрал";
aligns_alt["4"] = "Сенат";
aligns_alt["5"] = "Официальный Дилер";
aligns_alt["6"] = "Преторианец";
var s = ' <span style='cursor:hand;color:darkred;font-weight:bold;font-size:110%' onclick="top.PrivateSayTo(''+login+'');">»</span> ';
if( align )
s += '<a href="/lib/3_4.html" target=_blank><img src=/img/align'+align+'.gif width=20 height=13 border=0 alt=''+aligns_alt[align]+''></a> ';
if( klan!='' )
s += '<a href=/inform/clan/'+klan+'.html target=_blank><img src=/img/clan/'+klan+'.gif border=0 width=21 height=13></a>';
s += '<a href="javascript:window.top.SayTo(''+login+'');" style="text-decoration:none"><b>'+login+'</b></a>['+level+']<a href="/info.php?login='+login+'" target=_blank><img src=/img/inf.gif alt="'+login+'" width=12 height=11 border=0></a>';
if( gag == 1 )
s += ' <img src=/img/muzzle.gif alt="Рот закрыт кляпом" border=0 width=10 height=12>';
document.write(s+'<br>');
}
function online(kol,name_room) {
document.write('<center><table border=0 cellspacing=0 cellpadding=5 width=100%><tr><td align=center><input type=button value=Обновить onclick=javascript:window.location="online.php"; class=button style="font-weight:bold"></td></tr><td><b align=center>«'+name_room+'»</b><br>здесь находятся: <b>'+kol+' чел.</b></small></td></tr></table><br>');
}
function OnlineReload() {
top.frames["online"].location.href = 'online.php';
setTimeout("ChatReload()", 240*1000);
}
setTimeout("OnlineReload()", 240*1000);
</script>
</head>
<body bgcolor=#dbd7b6>
<?
$date = Date("Ymd");
if( $_SESSION["room"]!=$_SESSION["prev_room"] )
{
echo"<script language=Javascript>";
if(!@file_exists("chat/date/".$_SESSION["prev_room"]."/online.dat"))
@touch("chat/date/".$_SESSION["prev_room"]."/online.dat");
$file_online = @file("chat/date/".$_SESSION["prev_room"]."/online.dat");
$count_online = @count($file_online);
for($i=0;$i<=$count_online-1;$i++) {
$row_online = explode("|",$file_online[$i]);
if($row_online[3]==$_SESSION["login"])
unset($file_online[$i]);
}
$fp = @fopen("chat/date/".$_SESSION["prev_room"]."/online.dat","w");
@flock($fp,2);
@fwrite($fp,implode("",$file_online));
@flock($fp,3);
@fclose($fp);
$_SESSION["prev_room"] = $_SESSION["room"];
if(!@file_exists("chat/date/".$_SESSION["room"]."/".$date.".dat"))
@touch("chat/date/".$_SESSION["room"]."/".$date.".dat");
$array = @file("chat/date/".$_SESSION["room"]."/".$date.".dat");
$_SESSION["chat_id"] = @count($array)-1;
echo"top.frames['chat'].document.all('mes').focus();top.frames['chat'].document.all('mes').innerHTML='';top.frames['buttons'].document.all('text').focus();";
echo"</script>";
}
$file = @file("database/mess/telegraf.dat");
$num = @count($file);
$string = "";
for($i=0;$i<=$num-1;$i++) {
$row = explode("|",$file[$i]);
if($row[2]==$_SESSION["login"]) {
unset($file[$i]);
$string .= " <span style=color:#DC143C;background-color:#FFFACD;><small>".Date("H:i")."</small></span> <a href=javascript:top.SayTo('почтальон');>(<b>почтальон</b>)</a> <span style=color:#000000> <i>персонаж «".$row[1]."» ".$row[0]." передал вам телеграмму:</i> ".$row[3]." </span><br>";
}
}
$fp1 = @fopen("database/mess/telegraf.dat","w");
@flock($fp1,2);
@fwrite($fp1,implode("",$file));
@flock($fp1,3);
@fclose($fp1);
$muzzles_arr = array();
$file_m = @file("database/muzzles/muzzles.dat");
for($i_m=0;$i_m<=count($file_m)-1;$i_m++) {
$row_m = explode("|",$file_m[$i_m]);
if($row_m[2] > time())
$muzzles_arr[] = $row_m[0];
}
$past=time()-600;
$file = @file("chat/date/".$_SESSION["room"]."/online.dat");
$count = @count($file);
for($i=0;$i<=$count-1;$i++) {
$row = explode("|",$file[$i]);
if($row[1] < $past) {
unset($file[$i]);
if($row[3]==$_SESSION["login"])
$mydel = 1;
}
if($row[3]==$_SESSION["login"])
$find = 1;
}
$fp1 = @fopen("chat/date/".$_SESSION["room"]."/online.dat","w");
@flock($fp1,2);
@fwrite($fp1,implode("",$file));
@flock($fp1,3);
@fclose($fp1);
if( $find!=1 || $mydel==1 )
{
@include("connect.php");
$row_player = @mysql_fetch_array(mysql_query("select level,klan,align from users where id='".$_SESSION["id"]."'"));
$fp = @fopen("chat/date/".$_SESSION["room"]."/online.dat","a+");
@flock($fp,2);
@fwrite($fp,"|".time()."|".$row_player["align"]."|".$_SESSION["login"]."|".$row_player["level"]."|".$row_player["klan"]."|n");
@flock($fp,3);
@fclose($fp);
}
$rooms = explode(";",$config["rooms"]);
for($i=0;$i<=count($rooms)-2;$i++) {
$row = explode(",",$rooms[$i]);
if( $row[0]==$_SESSION["room"] )
$name_room = $row[1];
}
$arr_online = @file("chat/date/".$_SESSION["room"]."/online.dat");
$count_online = @count($arr_online);
echo"<script language=Javascript>online('".$count_online."','".$name_room."');</script>n";
$online_array = array();
for($i=1;$i<=$count_online-1;$i++) {
for($j=1;$j<=$count_online-1;$j++) {
$row_online1 = explode("|",$arr_online[$j-1]);
$row_online2 = explode("|",$arr_online[$j]);
if($row_online2[3] < $row_online1[3]) {
$t = $arr_online[$j-1];
$arr_online[$j-1] = $arr_online[$j];
$arr_online[$j] = $t;
}
}
}
echo"<table border=0 width=100%>
<tr>
<td nowrap>
<script langauge=JavaScript>n";
for($i=0;$i<=$count_online-1;$i++) {
$row_online = explode("|",$arr_online[$i]);
for($i_m_arr=0;$i_m_arr<=count($muzzles_arr)-1;$i_m_arr++) {
if( $muzzles_arr[$i_m_arr] == $row_online[3] )
$num_muzz = 1;
}
if( $num_muzz != 1 )
$num_muzz = 0;
echo"ch_show('".$row_online[3]."','".$row_online[4]."','".$row_online[2]."','".$num_muzz."','".$row_online[5]."');n";
$num_muzz=0;
}
echo "top.frames["chat"].text('".$string."');";
echo $string1;
?>
</script>
</td>
</tr>
</table>
<br>
</body>
</html>