header("HTTP/1.0 500 Internal Server Error"); echo 'Caught exception: ', $e->getMessage(), "\n"; } } elseif (isset($_POST["attendance_register"])) { try { $register = array(); foreach ($_POST as $key => $value) { if (substr($key, 0, strlen('attendance_')) == 'attendance_') { $foo = explode("_", $key); // Exclude the attendance_register entry, only go if we've got a real person record if ((int) $foo[1]) { $register[] = array('personnel_id' => $foo[1], 'attendance' => $value, 'note' => $_POST['note_' . $foo[1]]); } } } $ATC->set_activity_attendance((int) $_POST['activity_id'], $register); } 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";