function validateEmail() { global $dsql, $email, $emailcode, $checkcode, $password, $repassword; $isregcode = Helper_Archive::getEmailMsgConfig('reg_msgcode'); $isregcode = $isregcode['isopen']; if ($isregcode == 1 && (empty($emailcode) || $_SESSION['emailcode_' . md5($email)] != $emailcode)) { return '验证码错误'; } else { if ($isregcode != 1 && (empty($checkcode) || strtolower(GetCkVdValue()) != strtolower($checkcode))) { return '验证码错误'; } } $row = $dsql->GetOne("select count(*) as num from #@__member where email='{$email}'"); if ($row['num'] > 0) { return '该邮箱已经被注册'; } $pattern = "/([a-z0-9]*[-_\\.]?[a-z0-9]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+[\\.][a-z]{2,3}([\\.][a-z]{2})?/i"; if (!preg_match($pattern, $email)) { return '邮箱格式错误'; } if (strlen($password) < 6) { return '密码长度不得小于6位'; } if ($password != $repassword) { return '密码确认错误'; } return true; }