Beispiel #1
0
function reg($email, $pass, $name)
{
    try {
        $id = WaUser::FindUserIdByEmail($email);
    } catch (Exception $e) {
        returnError($e->getMessage());
    }
    if ($id) {
        returnError('这个邮箱已经注册过了。');
        return;
    }
    try {
        $id = WaUser::CreateUser($email, sha1($pass), $name, 5);
    } catch (Exception $e) {
        returnError($e->getMessage());
        return;
    }
    if (!$id) {
        returnError('注册失败。');
        return;
    }
    global $counter;
    initCounter();
    $counter->incr('usercount');
    login($email, $pass);
}