$_SESSION['opauth_error'] = 'Данный аккаунт социальной сети уже привязан к другому пользователю'; } header("Location: {$back_url}"); exit; } else { if ($type == OpauthHelper::ACTION_REGISTER) { $registrationData = OpauthHelper::getRegistrationData($response); $postedRole = $emp_redirect ? registration::ROLE_EMPLOYER : __paramInit('int', null, 'role_db_id'); $postedEmail = __paramInit('string', null, 'email'); $postedLogin = __paramInit('string', null, 'login'); if ($postedRole && $postedEmail && $postedLogin) { $registrationData['role'] = $postedRole; $registrationData['email'] = $postedEmail; $registrationData['login'] = $postedLogin; $registration = new registration(); $status = $registration->actionRegistrationOpauth($registrationData); if (isset($status['success']) && $status['success'] == true) { unset($_SESSION['opauth']); unset($_SESSION['opauth_role']); $opauthModel->create($status['user_id']); $redirect = $status['redirect']; if (is_emp() && $emp_redirect) { $redirect = $emp_redirect; } header('Location: ' . $redirect); exit; } } } else { unset($_SESSION['opauth']); unset($_SESSION['opauth_role']);