$form_sent = 0;
$errorMsg = '';
$UserList = array();
$message = '';
if (isset($_POST['form_sent']) && $_POST['form_sent']) {
    $form_sent = $_POST['form_sent'];
    $UserList = $_POST['sessionUsersList'];
    if (!is_array($UserList)) {
        $UserList = array();
    }
    if ($form_sent == 1) {
        if ($access_url_id == 0) {
            header('Location: access_url_edit_users_to_url.php?action=show_message&message=' . get_lang('SelectURL'));
            exit;
        } elseif (is_array($UserList)) {
            $result = UrlManager::update_urls_rel_user($UserList, $access_url_id);
            $url_info = UrlManager::get_url_data_from_id($access_url_id);
            if (!empty($result)) {
                $message .= 'URL: ' . $url_info['url'] . '<br />';
            }
            if (!empty($result['users_added'])) {
                $message .= '<h4>' . get_lang('UsersAdded') . ':</h4>';
                $i = 1;
                $user_added_list = array();
                foreach ($result['users_added'] as $user) {
                    $user_info = api_get_user_info($user);
                    if (!empty($user_info)) {
                        $user_added_list[] = $i . '. ' . api_get_person_name($user_info['firstname'], $user_info['lastname'], null, null, null, null, $user_info['username']);
                        $i++;
                    }
                }