Example #1
0
    }
    return -1;
}
$compName = cleanCompName(sqlite_escape_string($_POST['computerName']));
//$compProcesses = explode("|", $_POST['processes']);
if ($_POST['processes']) {
    $compProcesses = sqlite_escape_string($_POST['processes']);
}
$timeNow = time();
if ($compName != "") {
    $dbTrackHandler = connectDb();
    // Translate from computer name to Id
    $compNames = getCompNamesId($dbTrackHandler);
    $compId = $compNames[$compName];
    if (intval($compId) == 0) {
        // If the computer has not been seen before
        // Then we have to figure out what to do with it.
        // Let's see if the prefix of the computer matches any known region name
        // if that's the case, then we create a new entry in the computer table to track it.
        if ($add_unknown_computers) {
            $dbTrackHandler = connectDb();
            $regNames = getRegionNamesId($dbTrackHandler, true);
            $thisCompRegId = getCompRegion($compName, $regNames);
            $dbTrackHandler->query('INSERT INTO computers ' . '(name,x,y,region) ' . 'VALUES ("' . $compName . '", 0, 0, ' . $thisCompRegId . ');');
            $compNames = getCompNamesId($dbTrackHandler, true);
        }
    }
    if (intval($compId) != 0) {
        $dbTrackHandler->query('UPDATE computers ' . 'SET laststatus=' . AVAIBILITY_TYPE_BUSY . ', lastsignal=' . $timeNow . ' ' . 'WHERE id=' . $compId . '; ' . 'INSERT INTO trackrecords (`compid`, `time`, `status`) ' . 'VALUES ("' . $compId . '", ' . $timeNow . ', ' . AVAIBILITY_TYPE_BUSY . '); ' . ($compProcesses != "" ? 'INSERT INTO miscrecords (`compid`, `time`, `recordtype`, `data`) ' . 'VALUES ("' . $compId . '", ' . $timeNow . ', ' . RECORDTYPE_PROGRAMS . ', "' . $compProcesses . '"); ' : ''));
    }
}
        ?>
</font></td>
<td><?php 
        echo getCompNumType($MB[MB_COMP_NUM]);
        ?>
</td>
<td><?php 
        echo $MB[MB_COMP_TEL];
        ?>
</td>
<td><?php 
        echo $MB[MB_COMP_FAX];
        ?>
</td>
<td><?php 
        echo getCompRegion($MB[MB_COMP_ADDR1]);
        ?>
</td>

<td align=left>
<?php 
        if ($MB[MB_NOWLOG]) {
            ?>
<img src='./image/ico_online.gif' align=absmiddle alt='온라인' style='cursor:pointer;' onclick="showMeberData('<?php 
            echo $MB[MB_ID];
            ?>
','email')">
<?php 
        } else {
            ?>
<img src='./image/ico_offline.gif' align=absmiddle alt='오프라인' style='cursor:pointer;' onclick="showMeberData('<?php