require_once '/home/jrising/common/base.php'; require_once comdir("sql/dbfuncs.php"); $args = array_merge($_POST, $_GET); if ($args['pass'] != 'qhww0c') { echo "Password failure."; exit(0); } $dbc = dbconnect("memoir", "ignore"); if ($args['start']) { if (!strpos($args['start'], ' ')) { $args['start'] = date('Y-m-d ') . $args['start']; } } if ($args['op'] == 'a') { // Check what's active $row = dbgetrow("select task, time_start, adjusted_hours from times where time_start is not null and duration_hours is null"); if ($row) { if ($row[2] > 0) { echo "Active: " . $row[0] . ": " . $row[1] . " (-" . $row[2] . ") -"; } else { echo "Active: " . $row[0] . ": " . $row[1] . " -"; } } else { echo "None active."; } } else { if ($args['op'] == 'd') { // How much time have we spent on what in the last 24 hours? $row = dbgetarray("select task, time_start, duration_hours - adjusted_hours from times where time_start is not null and to_days(time_start) == to_days(now)"); print_r($row); } else {
function dbgetsingleton($sql, $column) { $row = dbgetrow($sql); return $row[$column]; }