Exemple #1
0
        extract($arr_form_data);
        if ($dbh_user->check_uniqueness($arr_form_data)->is_unique) {
            //Good, no duplicate in database
        } else {
            $message = "Record already exists with the same primary identifiers!";
        }
        if ($message == "") {
            require 'password_crypto.php';
            //Hash the password using default Cobalt password hashing technique
            $hashed_password = cobalt_password_hash('NEW', $password, $username, $new_salt, $new_iteration, $new_method);
            $arr_form_data['password'] = $hashed_password;
            $arr_form_data['salt'] = $new_salt;
            $arr_form_data['iteration'] = $new_iteration;
            $arr_form_data['method'] = $new_method;
            $dbh_user->add($arr_form_data);
            //Permissions from role, if role was chosen
            if ($role_id != '') {
                $db = new data_abstraction();
                $db->execute_query("INSERT `user_passport` SELECT '" . quote_smart($username) . "', `link_id` FROM user_role_links WHERE role_id='" . quote_smart($role_id) . "'");
            }
            redirect("listview_user.php?filter_field={$filter_field_used}&filter={$filter_used}&page_from={$page_from}&filter_sort_asc={$filter_sort_asc}&filter_sort_desc={$filter_sort_desc}");
        }
    }
}
require 'subclasses/user_html.php';
$html = new user_html();
$html->draw_header('Add User', $message, $message_type);
$html->draw_listview_referrer_info($filter_field_used, $filter_used, $page_from, $filter_sort_asc, $filter_sort_desc);
$html->fields['password']['control_type'] = 'password';
$html->draw_controls('add');
$html->draw_footer();