&1; echo $?'); if ($erg != 'Signature Verified' . "\n" . '0' . "\n") { print($erg); die(); } unlink($sig_file); unlink($msg_file); $result = $db->query('SELECT * FROM `computer_time` WHERE `name`="' . $key . '"'); $row = $result->fetchArray(); if (!$row) { print($key . ' is not known.'); die(); } $host = $row['host']; $bis = strtotime($row['bis']); $von = strtotime($row['von']); log_to_file('from_db ' . $key . ' ' . $_POST['msg'] . ' ' . $host . ' ' . $von . ' ' . $bis); if ($bis < $von) { $host = NULL; $bis = $von; } $bis = $bis + 30*60*(floor($now/60/60/24) - floor($von/60/60/24)); if (!is_null($host)) { $von = $now; } $noch = $bis - $von; if ($noch < 0) { $noch = 0; } if ($noch > 4*60*60) { $noch = 4*60*60; } $msg_parts = explode(' ', $_POST['msg'], 2); if ((1<=date('w')) && (date('w')<=5) && (date('G')<16)) { print("0\n"); } else { print($noch . "\n"); } switch ($msg_parts[1]) { case 'start': $host = $msg_parts[0]; break; ;; case 'stop': if ($host == $msg_parts[0]) { $host = NULL; } break; ;; default: print($_POST['msg'] . ' unknown'); die(); ;; } if ($noch == 0) { $host = NULL; } $von = date('Y-m-d H:i:s', $now); $bis = date('Y-m-d H:i:s', $now + $noch); if (is_null($host)) { $host = 'NULL'; } else { $host = '"' . $host . '"'; } log_to_file('to_db ' . $key . ' ' . $host . ' ' . $von . ' ' . $bis); $db -> exec( 'UPDATE `computer_time`' . ' SET `host`=' . $host . ',' . '`von`="' . $von . '",' . '`bis`="' . $bis . '"' . ' WHERE `name`="' . $key . '"'); die(); } $result = $db->query('select * from `computer_time`'); ?>