Exemplo n.º 1
0
    if ($mark == -1) {
        $Q = "SELECT name,seqid,type,srvid,team,text,UNIX_TIMESTAMP(`date`) AS `date` FROM `chatlogs` ORDER BY `seqid` DESC LIMIT {$START_ROWS}";
    } else {
        $Q = "SELECT name,seqid,type,srvid,team,text,UNIX_TIMESTAMP(`date`) AS `date` FROM `chatlogs` WHERE `seqid` > {$mark} ORDER BY `seqid` DESC";
    }
    $Q = @mysql_query($Q, $SQL) or die("MySQL Failure: " . mysql_error());
    $ar = array();
    $R = mysql_fetch_array($Q);
    if (!$R) {
        // No new data, echo same mark back
        echo $mark;
        exit;
    }
    $newmark = $R['seqid'];
    do {
        array_push($ar, formatRow($R));
    } while ($R = mysql_fetch_array($Q));
    array_push($ar, $newmark);
    // Add mark to bottom (top once reversed)
    $ar = array_reverse($ar);
    // Query selects rows in reverse order, and mark is on bottom
    echo implode("\n", $ar);
} else {
    $Q = "SELECT DISTINCT `srvid` FROM `chatlogs`";
    $Q = @mysql_query($Q, $SQL) or die("MySQL Failure: " . mysql_error());
    $PB = "";
    $PS = "";
    while ($R = mysql_fetch_row($Q)) {
        $id = cleanId($R[0]);
        $PB .= "<div class=\"dat\">\n\t\t\t\t<div class=\"dhead\">Server \"{$R['0']}\"</div>\n\t\t\t\t<div class=\"dbody\" id=\"dbody_{$id}\">\n\t\t\t\t\t<div class=\"dtext\" id=\"dat_{$id}\"></div>\n\t\t\t\t\t<div id=\"dscrollto_{$id}\"></div>\n\t\t\t\t</div>\n\t\t\t</div>\n";
        $PS .= "srvz.push(\"{$id}\");\n";
Exemplo n.º 2
0
$stopString = "CUPS and the CUPS logo";
foreach ($dom->getElementsByTagName('tr') as $tr) {
    $cells = array();
    foreach ($tr->getElementsByTagName('td') as $td) {
        $cells[] = $td->nodeValue;
    }
    $myIndex++;
    //Only get the data that is about printing
    if ($myIndex > 4) {
        //The status of the print job
        $theStatus = substr($cells[5], 0, strpos($cells[5], " at"));
        //echo $theStatus;
        $completed = "completed";
        if (strpos($cells[5], "completed") != FALSE) {
            //Only store completed jobs
            //echo 'status pass';
            //Do not store the last line which is about CUPS the product
            if (substr($cells[0], 0, strlen($stopString)) != $stopString) {
                //echo formatRow($cells);
                $data[] = formatRow($cells);
                //$cells;
            }
        }
    }
}
//print_r($data);
$tester = writeToDataBase($data);
?>
    </body>
</html>