*/ /** Setting the minimum access level */ if ($user->getAccessLevel(2)) { /** Doing All POST action work */ if (isset($_POST['action'])) { /** Doing action stuff */ if ($_POST['action'] == "group_create") { /** We're creating a new group, so let's start the work by getting our POST'ed variabled */ $groupName = $_POST['group_name']; $groupOwner = $user->getUserID(); $groupJoinMethod = $_POST['group_join_method']; $groupType = $_POST['group_type']; $groupTypeConstraintName = $_POST['membership_constraint']; /** Looking up the correct ID for the name provided*/ $eve = new Eve($db); $groupTypeConstraintLookup = $eve->getCharacterID($groupTypeConstraintName); /** Verifying that we got an ojbect back */ if (is_object($groupTypeConstraintLookup) && $groupTypeConstraintLookup->characterID !== null) { /** Saving the ID of the name we looked up */ $groupTypeConstraintID = $groupTypeConstraintLookup->characterID; $stmt_create_group = $db->prepare('INSERT INTO groups_overview (group_name,group_owner,group_join_method,group_type,' . 'group_type_constraint_id,group_type_constraint_name) VALUES (?,?,?,?,?,?)'); $stmt_create_group->execute(array($groupName, $groupOwner, $groupJoinMethod, $groupType, $groupTypeConstraintID, $groupTypeConstraintName)); $stmt_group_id_lookup = $db->prepare('SELECT group_id FROM groups_overview WHERE group_owner = ? ORDER BY group_id DESC LIMIT 1'); $stmt_group_id_lookup->execute(array($user->getUserID())); $groupIDLookup = $stmt_group_id_lookup->fetch(\PDO::FETCH_ASSOC); $user->updateGroupMembership($groupIDLookup['group_id']); } elseif (is_object($groupTypeConstraintLookup)) { /** The name given doesn't match a corporation or alliance */ $_SESSION['alert'] = new Alert('danger', 'The Corporation or Alliance name provided does not exist. If it was recently created wait an hour for the API to update and try again.'); } else { /** API failure, so we'll give a more generic message */