Ejemplo n.º 1
0
function users_create_user($user)
{
    #
    # set up some extra fields first
    #
    loadlib('random');
    $user['password'] = passwords_encrypt_password($user['password']);
    $user['created'] = time();
    $user['conf_code'] = random_string(24);
    $user['cluster_id'] = users_assign_cluster_id();
    #
    # now create the escaped version
    #
    $hash = array();
    foreach ($user as $k => $v) {
        $hash[$k] = AddSlashes($v);
    }
    $rsp = db_insert('Users', $hash);
    if (!$rsp['ok']) {
        return null;
    }
    #
    # cache the unescaped version
    #
    $user['id'] = $rsp['insert_id'];
    $cache_key = "user_{$user['id']}";
    cache_set($cache_key, $user, 'cache locally');
    return $user;
}
Ejemplo n.º 2
0
function users_create_user($user)
{
    #
    # set up some extra fields first
    #
    loadlib('random');
    $user['password'] = login_encrypt_password($user['password']);
    $user['created'] = time();
    $user['conf_code'] = random_string(24);
    $user['cluster_id'] = users_assign_cluster_id();
    #
    # now create the escaped version
    #
    $hash = array();
    foreach ($user as $k => $v) {
        $hash[$k] = AddSlashes($v);
    }
    $rsp = db_insert('users', $hash);
    if (!$rsp['ok']) {
        return null;
    }
    #
    # cache the unescaped version
    #
    $user['id'] = $rsp['insert_id'];
    $GLOBALS['user_local_cache'][$user['id']] = $user;
    return $user;
}
Ejemplo n.º 3
0
function users_create_user($user)
{
    #
    # set up some extra fields first
    #
    loadlib('random');
    $user['password'] = passwords_encrypt_password($user['password']);
    $user['created'] = time();
    $user['conf_code'] = random_string(24);
    $user['cluster_id'] = users_assign_cluster_id();
    #
    # now create the escaped version
    #
    $hash = array();
    foreach ($user as $k => $v) {
        $hash[$k] = AddSlashes($v);
    }
    $ret = db_insert_accounts('users', $hash);
    if (!$ret['ok']) {
        return $ret;
    }
    #
    # cache the unescaped version
    #
    $user['id'] = $ret['insert_id'];
    cache_set("USER-{$user['id']}", $user);
    return array('ok' => 1, 'user' => $user);
}