');
$recaptcha = req('https://api-secure.recaptcha.net/challenge'.$recaptha_params, false, false);
$auth_key = between($twitter, '');
$challenge = between($recaptcha, "challenge : '", "',");
echo
'
Let\'s tear down this wall!
';
} else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$error_msg = false;
$fields = array( 'name', 'screen_name', 'user_password', 'email' );
foreach ($fields as $field) {
if (!strcmp($_POST['user'][$field], '')) {
$error_msg = '所有选项均为必填。';
break;
}
}
if (!$error_msg && strlen($_POST['user']['user_password']) < 6) {
$error_msg = '密码长度不够。';
}
if (!$error_msg) {
$r = req('https://twitter.com/account/create', @file_get_contents('php://input'), false);
$err_msg = array(
'You can\'t do that right now.' => '出现未知错误。',
'Please try to match the 2 words shown above' => '验证码输入错误。',
'has already been taken' => '用户名或邮箱已有人使用。',
'is not a valid email address' => '邮箱格式不正确。'
);
foreach ($err_msg as $k => $v) {
if (strpos($r, $k) !== false) {
$error_msg = $v;
break;
}
}
}
if (!$error_msg) {
echo '注册成功,请到注册的邮箱中查收邮件。';
} else {
echo $error_msg.'请返回注册页面重试。';
}
}
?>