} else { // Check for pre-existing contact with same name if ($lilac->contact_exists($tempData['contact_name'])) { $error = "A contact with that name already exists!"; } else { $tempContactGroup = $tempData['contact_group']; unset($tempData['contact_group']); // All is well for error checking, add the contact into the db. $contact = $lilac->add_contact($tempData); $success = "Contact added"; if ($tempContactGroup && $tempContactGroup != 0) { $contactGroup = NagiosContactGroupPeer::retrieveByPK($tempContactGroup); if ($contactGroup && $contact) { $contactGroupMember = new NagiosContactGroupMember(); $contactGroupMember->setContact($contact->getId()); $contactGroupMember->setContactgroup($contactGroup->getId()); $contactGroupMember->save(); } } unset($_GET['contact_add']); } } } else { if ($_POST['request'] == 'modify_contact') { // Error check! if (count($tempData)) { foreach ($tempData as $tempVariable) { $tempVariable = trim($tempVariable); } } // We have checkboxes, let's verify the data against POST