/**
  * 新用户注册
  */
 public function register()
 {
     global $G;
     $username = htmlspecialchars(trim($_GET['username']));
     $mobile = trim($_GET['mobile']);
     $password = trim($_GET['password']);
     if (!$username) {
         $this->showAppError(-1, '用户名输入错误', array('username' => $username));
     }
     if ($this->_verifyUsername($username)) {
         $this->showAppError(-2, '用户名已被人使用', array('username' => $username));
     }
     if (!ismobile($mobile)) {
         $this->showAppError(-3, '手机号输入错误', array('mobile' => $mobile));
     }
     if ($this->_verifyMobile($mobile)) {
         $this->showAppError(-4, '手机号已被注册', array('mobile' => $mobile));
     }
     if (strlen($password) < 6) {
         $this->showAppError(-5, '密码输入错误', array('password' => $password));
     }
     $member = new Member();
     $returns = $member->register($username, $password, $mobile, 'mobile');
     if ($member->uid > 0) {
         $returns['userpic'] = avatar($member->uid);
         $this->showAppData($returns);
     } else {
         $this->showAppError(-6, '注册失败', array('info' => 'system error'));
     }
 }
 /**
  * 保存注册信息
  */
 function save()
 {
     $username = htmlspecialchars(trim($_GET['username_' . FORMHASH]));
     $password = trim($_GET['password_' . FORMHASH]);
     $email = trim($_GET['email_' . FORMHASH]);
     $captchacode = trim($_GET['captchacode']);
     $this->checkCaptchacode($captchacode);
     if (strlen($username) < 2) {
         $this->showError('username_verify_failed');
     }
     if ($this->_verify(array('username' => $username))) {
         $this->showError('username_exists');
     }
     if (empty($email) || !isemail($email)) {
         $this->showError('email_verify_failed');
     }
     if ($this->_verify(array('email' => $email))) {
         $this->showError('email_exists');
     }
     if (empty($password) || strlen($password) < 6) {
         $this->showError('password_verify_failed');
     }
     $member = new Member();
     $returns = $member->register($username, $password, $email, $_GET['type']);
     if ($member->uid > 0) {
         $this->showSuccess('register_succeed', '/?m=home', array(), '', true);
     }
 }