public static function getEmail() { return infra_session_getEmail(); }
return infra_err($ans, 'You must specify a valid email address'); } $user = infra_session_getUser($email); // еще надо проверить есть ли уже такой емаил if ($user['session_id']) { return infra_err($ans, 'This email already registered.'); } $password = trim($_POST['password']); if (!User::checkData($password, 'password')) { return infra_err($ans, 'You must specify a valid password'); } $repeatpassword = trim($_POST['repeatpassword']); if ($password != $repeatpassword) { return infra_err($ans, 'Passwords do not match.'); } $myemail = infra_session_getEmail(); if ($myemail) { return infra_err($ans, 'You are already logged in'); } //Значит пользователь не зарегистрирован $term = trim($_POST['terms']); if (!$term) { return infra_err($ans, 'You need to accept the terms of service.'); } $password = md5($email . $password); $data = array(); $data['key'] = md5($password . date('Y.m.j')); infra_session_setEmail($email); infra_session_setPass($password); infra_view_setCookie(infra_session_getName('pass'), md5($password)); $ans['go'] = '?user';