<?php require_once "atc.class.php"; $ATC = new ATC(); if (isset($_POST['startdate']) && strtotime($_POST['startdate']) && isset($_POST['enddate']) && strtotime($_POST['enddate'])) { try { $ATC->add_term(strtotime($_POST['startdate']), strtotime($_POST['enddate'])); } catch (ATCExceptionInsufficientPermissions $e) { header("HTTP/1.0 401 Unauthorised"); echo 'Caught exception: ', $e->getMessage(), "\n"; } catch (ATCExceptionDBError $e) { header("HTTP/1.0 500 Internal Server Error"); echo 'Caught exception: ', $e->getMessage(), "\n"; } catch (ATCExceptionDBConn $e) { header("HTTP/1.0 500 Internal Server Error"); echo 'Caught exception: ', $e->getMessage(), "\n"; } catch (ATCException $e) { header("HTTP/1.0 400 Bad Request"); echo 'Caught exception: ', $e->getMessage(), "\n"; } catch (Exception $e) { header("HTTP/1.0 500 Internal Server Error"); echo 'Caught exception: ', $e->getMessage(), "\n"; } exit; // Save the attendance register } elseif (isset($_POST['attendance_register']) && $_POST['attendance_register']) { try { foreach ($_POST as $entry => $status) { $foo = explode("|", $entry); if (count($foo) == 2) { $ATC->set_attendance_register($foo[0], $foo[1], $status);