Esempio n. 1
0
if (!isset($_SESSION['name'])) {
    loginForm();
} else {
    ?>
<div id="wrapper">
    <div id="menu">
             <p class="welcome">Welcome, <b><?php 
    echo $_SESSION['name'];
    ?>
</b></p>
        <p class="logout"><a id="exit" href="#">Exit Chat</a></p>
        <div style="clear:both"></div>
    </div>    
    <div id="chatbox">
<?php 
    readLog();
    ?>
    </div>
     
    <form class="" role="form" name="message" action="">
        <input name="usermsg" id="usermsg" type="text" maxlength="63" />
        <input name="submitmsg" type="submit"  id="submitmsg" value="Send" />
    </form>
</div>

<script type="text/javascript">

//Load the file containing the chat log
function loadLog(){
    var oldscrollHeight = $("#chatbox").prop("scrollHeight") - 20; //Scroll height before the request
    $.ajax({
Esempio n. 2
0
if (isset($_GET["min"])) {
    $min = $_GET["min"];
}
if (isset($_GET["max"])) {
    $max = $_GET["max"];
}
$class = Auth::curClass();
echo "<script>setRange('{$min}','{$max}');\n</script>";
$fs = new NativeFS("./log/");
foreach ($fs->ls("/") as $n) {
    $n = "/{$n}";
    if (strpos($n, $class) != FALSE) {
        if (preg_match("/-data-time/", $n)) {
            $er = preg_replace("/-data-time/", "-data-error", $n);
            if ($fs->exists($er)) {
                readLog($n, $er);
            }
        } else {
            if (preg_match("/-data.log/", $n)) {
                readJSONLog($n);
            }
        }
    }
}
function readLog($time, $error)
{
    global $fs, $min, $max;
    echo "<script>queue.push(function () {\n";
    echo "setUser('{$time}');\n";
    echo "setColor('green');\n";
    $tlines = explode("\n", $fs->getContent($time));
    if ($XUSER['LEVEL'] != 3 && $XUSER['LEVEL'] != 4 && $XUSER['LEVEL'] != 5) {
        $body = $txt[420];
    } else {
        $logsize = @filesize("Logs/{$ROOMS['IN_ROOM_NAME']}.log");
        $maxsize = $SERVER['MAXLOG'];
        $percentage = round($logsize / $maxsize * 100);
        if ($percentage == "") {
            $percentage = 0;
        }
        $txt[423] = eregi_replace("%p", "{$percentage}", $txt[423]);
        if ($percentage >= 100) {
            $spaceinfo = $txt[424];
        } else {
            $spaceinfo = $txt[423];
        }
        $log = readLog($ROOMS['IN_ROOM_NAME']);
        $log = codeparse($log);
        $log = eregi_replace("\n", "<Br>", $log);
        $body = "<div align=\"left\">" . $log . "<Br><Br>{$spaceinfo}<Br><Br><a href=\"index.php\">{$txt['6']}</a>";
    }
} elseif ($action == "roomset") {
    $temp = eregi_replace("\\\\'", "'", $ROOMS['IN_ROOM_NAME']);
    $body = "<Br>\n<form action=\"roomcontrol.php\" method=\"post\">\n<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\" bgcolor=\"{$CS['3']}\">\n<Tr><td><div align=\"center\">\n<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"{$CS['3']}\">\n<tr valign=\"top\">\n<td width=\"150\" bgcolor=\"{$CS['2']}\">{$txt['27']}</td>\n\n<td width=\"350\" bgcolor=\"{$CS['2']}\">{$temp}</td>\n</tr>\n<tr valign=\"top\">\n<td width=\"150\" bgcolor=\"{$CS['2']}\">{$txt['28']}</td>\n<td width=\"350\" bgcolor=\"{$CS['2']}\">\n<select name=\"type\">\n<option value=\"1\"";
    if ($ROOMS['TYPE'] == "Public") {
        $body .= " SELECTED";
    }
    $body .= ">{$txt['29']}</option>";
    if ($PERMISSIONS['CR_Private'] != 1) {
        $body .= "<option value=\"2\"";
        if ($ROOMS['TYPE'] != "Public") {
            $body .= " SELECTED";
                    $chartData[$j]->nonet++;
                }
            }
        }
        if (strpos($logArray[$i]->msg, "not logged in") > -1) {
            for ($j = 0; $j < $countForChart; $j++) {
                if ($chartData[$j]->date == $logArray[$i]->date) {
                    $chartData[$j]->login++;
                }
            }
        }
    }
    return $chartData;
}
// Initizing data for log and chart
$logData = readLog($LogFilePath);
$charData = readDateFromLog($logData);
// Watchdog
function netWatchdog()
{
    global $NCSIServer, $DialServer, $NetDetectCycle;
    while (true) {
        $i_c = 0;
        $c_c = 0;
        for ($i = 0; $i < 1; $i++) {
            $c_status = FCurl("http://{$DialServer}", 1);
            $i_status = FCurl($NCSIServer, 5);
            if (strpos($c_status, "portal4HN") > -1) {
                $c_c++;
            }
            if (strpos($i_status, "Microsoft NCSI") > -1) {