1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
|
<?php
function arsc_shutdown()
{
GLOBAL $arsc_sid,
$arsc_my;
if ($arsc_my["user"] <> "")
{
$arsc_user = $arsc_my["user"];
$arsc_room = $arsc_my["room"];
$arsc_nice_room = arsc_nice_room($arsc_room);
$arsc_timeid = arsc_microtime();
$arsc_sendtime = date("H:i:s");
mysql_query("DELETE from arsc_users WHERE sid = '$arsc_sid'");
mysql_query("INSERT into arsc_room_$arsc_room (message, user, sendtime, timeid) VALUES ('arsc_user_quit~~$arsc_user~~$arsc_nice_room', 'System', '$arsc_sendtime', '$arsc_timeid')");
}
}
register_shutdown_function("arsc_shutdown");
include("../config.inc.php");
include("../functions.inc.php");
include("../filter.inc.php");
if ($arsc_my = arsc_getdatafromsid($arsc_sid))
{
include("../shared/language/".$arsc_my["language"].".inc.php");
$arsc_room = $arsc_my["room"];
if ($arsc_lastid == "")
{
$arsc_result = mysql_query("SELECT * from arsc_room_$arsc_room ORDER BY timeid DESC");
$arsc_b = mysql_fetch_array($arsc_result);
$arsc_lastid = $arsc_b["timeid"];
}
echo $arsc_parameters["htmlhead_js"];
set_magic_quotes_runtime(0);
@set_time_limit(0);
$arsc_sendtime = date("H:i:s");
$arsc_timeid = arsc_microtime();
$arsc_message = "/msg ".$arsc_my["user"]." ".$arsc_lang["welcome"];
echo arsc_filter_posting("System", $arsc_sendtime, $arsc_message, $arsc_room, 0);
$i = 0;
while(!connection_aborted())
{
$arsc_my = arsc_getdatafromsid($arsc_sid);
$arsc_room = $arsc_my["room"];
if(!$arsc_result = mysql_query("SELECT * from arsc_room_$arsc_room ORDER BY timeid DESC"))
{
arsc_shutdown();
die();
}
$arsc_b = mysql_fetch_array($arsc_result);
if ($arsc_lastid == "")
{
$arsc_lastid = $arsc_b["timeid"];
}
$arsc_lastid_save = $arsc_b["timeid"];
if ($arsc_my["level"] < 0)
{
switch($arsc_my["level"])
{
case "-1": echo arsc_filter_posting("System", date("H:i:s"), "<font size=\"4\"><b>".$arsc_lang["youwerekicked"]."</b></font>", $arsc_room, 0);
mysql_query("DELETE from arsc_users WHERE sid = '$arsc_sid'");
break;
}
break;
}
$i++;
$arsc_result = mysql_query("SELECT * from arsc_room_$arsc_room WHERE timeid > '$arsc_lastid' ORDER BY timeid ASC, id ASC");
while ($arsc_a = mysql_fetch_array($arsc_result))
{
$arsc_posting = arsc_filter_posting($arsc_a["user"], $arsc_a["sendtime"], $arsc_a["message"], $arsc_room, $arsc_a["flag_ripped"]);
echo "$arsc_posting";
}
$arsc_lastid = $arsc_lastid_save;
$arsc_ping = time();
$arsc_ip = getenv("REMOTE_ADDR");
mysql_query("UPDATE arsc_users SET lastping = '$arsc_ping', ip = '$arsc_ip' WHERE sid = '$arsc_sid'");
echo " ";
flush();
usleep($arsc_parameters["socketserver_refresh"]);
flush();
flush();
flush();
flush();
flush();
// just to be sure :)
}
}
else
{
echo $arsc_parameters["htmlhead_out"];
}
?>
|