$_SESSION['error'] = "An error has occurred, please try again."; } } } else { $_SESSION['error'] = "An error has occurred, please try again."; } break; case 'sitereg': if (isset($_POST['centreID']) && is_numeric($_POST['centreID'])) { $centreEdit = new Centre($_POST['centreID']); if ($user->getPrivilege() >= 10) { $_SESSION['error'] = "You do not have the privilege to edit centres."; } elseif ($centreEdit->getCountry() != $user->getCountry() && !$user->isCentralAdmin()) { $_SESSION['error'] = "You cannot edit centres from other countries."; } elseif ($_POST['deleteCentre'] === '1' && $user->isCentralAdmin()) { $centreEdit->deleteCentre(); $sql = "DELETE FROM centreUnits WHERE centre_id = ?"; $pA = array('i', $centreID); DB::query($sql, $pA); $_SESSION['message'] = "You have deleted the centre."; } elseif ($user->isCentralAdmin() && $_POST['toggleLock'] === '1') { $centreEdit->toggleLock(); if ($centreEdit->isLocked()) { $_SESSION['message'] = "The centre is now locked for data entry."; } else { $_SESSION['message'] = "The centre is now open for data entry."; } } else { if ($trial->addUserInput($_POST, $centreEdit)) { $centreID = $centreEdit->saveToDB(); if (isset($_POST['units'])) {