我一直在通过我的联系表单收到垃圾邮件,长话短说我的验证码不起作用。我使用了Sweet Captcha(http://sweetcaptcha.com/)因为这提供了更加用户友好的方法。当用户点击提交时,它会正常发布到我的电子邮件中,但是它不需要用户预先形成验证码,因此导致来自伟哥公司的垃圾邮件......你能快速查看并查看我的位置我出错了。任何帮助都会一如既往地受到赞赏。
谢谢
安迪
<?php
// require sweetcaptcha php sdk, don't forget to set up your credentials first
require_once('sweetcaptcha.php');
if (empty($_POST)) {
// print sweetcaptcha in your form
?>
<p class="name">
<input type="text" name="name" id="name" placeholder="Your Name" required="required" requiredmessage="Name is required."/>
</p>
<p class="email">
<input type="text" name="email" id="email" placeholder="mail@example.com" required="required"/>
</p>
<p class="web">
<input type="text" name="web" id="web" placeholder="www.example.com *Not Mandatory*" />
</p>
<p class="text">
<textarea name="text" placeholder="How can I help?" required="required"></textarea>
</p>
<!-- implemet sweetcaptcha -->
<?php echo $sweetcaptcha->get_html(); ?>
<!-- continue with your form -->
<input type="submit" />
</form>
<?php
} else {
// looks like someone has submitted a form, let's validate it
if (isset($_POST['sckey']) and isset($_POST['scvalue']) and $sweetcaptcha- >check(array('sckey' => $_POST['sckey'], 'scvalue' => $_POST['scvalue'])) == "true") {
// success! your form was validated
// do what you like next ...
echo "Success! carry on if you will";
}
else {
// alas! the validation has failed, the user might be a spam bot or just got the result wrong
// handle this as you like
echo "Boohoo! captcha validation failed!";
}
}
?>
答案 0 :(得分:0)
切换到reCaptcha,或其他替代验证码系统,似乎......
你的代码似乎是正确的(我可以挑剔== vs ===和isset / empty vs array_key_exists和_SERVER [“REQUEST_METHOD”],但是我很懒),所以... check()调用是烦恼,或者甜蜜被打破..
作为一个可怕的有趣事件,XRumer / Botmasterlabs多年来一直破解reCaptcha和PhpBB / Gmail / Yahoo / Hotmail注册验证码(至少到2010年,我还没有及时更新他们的更改日志......)< / p>