我正在使用recaptcha考虑批量垃圾邮件。我使用captcha.php应用了recaptcha,如下面的代码所示:
<?php
$ContactButton;$captcha;
if(isset($_POST['ContactButton'])){
$ContactButton=$_POST['ContactButton'];
/*}if(isset($_POST['comment'])){
$email=$_POST['comment'];*/
}if(isset($_POST['g-recaptcha-response'])){
$captcha=$_POST['g-recaptcha-response'];
}
if(!$captcha){
header('Location: http://www.globalcrossroad.com/apply/index11.php?CaptchaFail=True');
exit;
}
$url = 'https://www.google.com/recaptcha/api/siteverify';
$privatekey = "6LdoaxgTAAAAAGTViBjCSSurdWwIG_bgA6tkHCYK";
$response = file_get_contents($url."?secret=".$privatekey."&response=".$_POST['g-recaptcha-response']."&remoteip=".$_SERVER['REMOTE_ADDR']);
$data = json_decode($response);
if($response.success==false)
{
echo '<h2>You are spammer ! Get out</h2>';
}else
{
echo '<h2>Submission Success</h2>';
}
?>
recaptcha似乎工作正常。但我真正头痛的是,我怎样才能首先验证recaptcha,并在验证后将其发送到我现有的process.php,它将表单数据发送到数据库。有什么办法我可以通过captcha.php并继续process.php来完成这个过程。
请让我知道如何首先实际处理captcha.php并将其重定向到process.php
答案 0 :(得分:2)
如何在process.php中运行所有内容
ws.set_column(0, 0, 10.2, format)
ws.set_column(1, 1, 25.2, format)
ws.set_column(2, 2, 15.2, format)
或者您实际上可以使用标题重定向
public function isValid($dao)
{
if (strpos($this->email, '@') === false) {
$this->errors['email'] = 'Please enter an email address';
}
if ($dao->isEmailUnique($this->email) === false) {
$this->errors['email'] = 'Email address should be unique';
}
// ...
return !$this->errors;
}