Also, you can do this by your own way using database module.
ex.
//change
$inserted_data = $storage->insert(
'user', [
'type' => trim(addslashes(strip_tags($_POST['type']))),
'username' => trim(addslashes(strip_tags($_POST['username']))),
'password' => md5($_POST['password'])
]
);
//with
$inserted_data = $db->insert(
'user', [
'type' => trim(addslashes(strip_tags($_POST['type']))),
'username' => trim(addslashes(strip_tags($_POST['username']))),
'password' => md5($_POST['password'])
]
);
Methods for "storage" module and "database" module are very similar.
Documentation link for database module:
xmodule.eco.mk/module/database