有人可以帮我登录后自动注册吗,这是我的注册脚本...
if (empty($_POST) === false) {
$required_fields = array ('email', 'username', 'password', 'password_again', 'first_name', 'last_name');
foreach ($_POST as $key=>$value) {
if (empty($value) && in_array($key, $required_fields) === true) {
$errors [] = 'ALL fields MUST be filled out correctly';
break 1;
}
}
if (empty($errors) === true) {
if (user_exists($_POST['email']) === true) {
$errors [] = 'Sorry, the email \'' . $_POST['email'] . '\' is already in use.';
}
if (preg_match("/\\s/", $_POST['email']) == true) {
$errors[] = 'Your email must not contain any spaces';
}
if (user_exists($_POST['username']) === true) {
$errors [] = 'Sorry, the username \'' . $_POST['username'] . '\' is already in use.';
}
if (preg_match("/\\s/", $_POST['username']) == true) {
$errors[] = 'Your username must not contain any spaces';
}
if (strlen($_POST['password']) < 6) {
$errors[] = 'Your password must be in between 6-24 characters long';
}
if ($_POST['password'] !== $_POST ['password_again']) {
$errors[] = 'Your passwords did not match';
}
}
}
?>
这段代码只注册用户,我也想让它登录,你能不能不要给这个差评