if(!preg_match('/^[\x7f-\xff]+$/',$username)){
echo "<script>alert('请输入正确的姓名!');history.back();</script>"; exit;
}
if (!preg_match('/^[a-zA-Z0-9_*]{6,10}$/', $password)){
echo "<script>alert('密码只能为大小写字符和数字,以及*、_构成,长度为6到10个字符!');history.back();</script>"; exit;
}
if (!preg_match('/^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|17[0|1|2|3|4|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$/', $phone)) {
echo "<script>alert('请输入正确的手机号,手机号前两位只能为13、14、15、18且长度为11位!');history.back();</script>"; exit;
}
if (!preg_match('/^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/', $email)) {
echo "<script>alert('邮箱只能为 ***@**.com的形式,长度为7~20位!');history.back();</script>"; exit;
}
if (!preg_match('/^(男|女|中性)$/', $sex)) {
echo "<script>alert('性别只能为男、女、中性!');history.back();</script>"; exit;
}