コード例 #1
0
/**
 * adds an user by prompt
 * @param array $options
 * @return int $res
 */
function useradd_add($options = null)
{
    $values['email'] = common::readSingleline("Enter Email of super user (you will use this as login): ");
    $values['password'] = common::readSingleline("Enter password: ");
    $values['password'] = md5($values['password']);
    $values['username'] = $values['email'];
    $values['verified'] = 1;
    $values['admin'] = 1;
    $values['super'] = 1;
    $values['type'] = 'email';
    $res = useradd_db_insert($values);
    if ($res) {
        return 0;
    } else {
        return 1;
    }
}
コード例 #2
0
/**
 * Adds an admin user directly. Note: Password have to be the md5 of the real password. 
 * @param array $options
 * @return int
 */
function useradd_direct_add_admin($options = null)
{
    $values['email'] = $options['email'];
    $values['password'] = $options['password'];
    // MD5
    $values['username'] = $values['email'];
    $values['verified'] = 1;
    $values['admin'] = 1;
    $values['super'] = 0;
    $values['type'] = 'email';
    $res = useradd_db_insert($values);
    if ($res) {
        return 0;
    } else {
        return 1;
    }
}