cvs: pearweb /public_html account-request-vote.php
[email protected] ("Helgi ?ormar ?orbj?rnsson") Tue, 06 May 2008 20:18:33 -0000
| Newsgroups | php.pear.cvs,php.pear.core |
|---|---|
| Message-ID | <cvsdufuz1210105113@cvsserver> |
dufuz Tue May 6 20:18:33 2008 UTC
Modified files:
/pearweb/public_html account-request-vote.php
Log:
Add Services_HoneyPot to prevent spammers and unwanted people from requesting an account
Work in progress
# Adding to other account pages later on
http://cvs.php.net/viewvc.cgi/pearweb/public_html/account-request-vote.php?r1=1.15&r2=1.16&diff_format=u
Index: pearweb/public_html/account-request-vote.php
diff -u pearweb/public_html/account-request-vote.php:1.15 pearweb/public_html/account-request-vote.php:1.16
--- pearweb/public_html/account-request-vote.php:1.15 Fri Apr 4 20:45:39 2008
+++ pearweb/public_html/account-request-vote.php Tue May 6 20:18:32 2008
@@ -15,19 +15,19 @@
+----------------------------------------------------------------------+
| Authors: |
+----------------------------------------------------------------------+
- $Id: account-request-vote.php,v 1.15 2008/04/04 20:45:39 dufuz Exp $
+ $Id: account-request-vote.php,v 1.16 2008/05/06 20:18:32 dufuz Exp $
*/
require_once 'HTML/QuickForm.php';
require_once 'Damblan/Mailer.php';
require_once 'election/pear-election-accountrequest.php';
require_once 'Text/CAPTCHA/Numeral.php';
+require_once 'Services/ProjectHoneyPot.php';
$numeralCaptcha = new Text_CAPTCHA_Numeral();
session_start();
$display_form = true;
-$width = 60;
$errors = array();
$jumpto = 'handle';
@@ -109,6 +109,30 @@
}
} while (0);
+try {
+ // Uncomment this if you need to test on Windows
+ $resolver = null;
+ //$resolver = new Net_DNS_Resolver;
+ //$resolver->nameservers = array('66.114.197.251');
+
+ $sphp = Services_ProjectHoneyPot::factory(HONEYPOT_API_KEY, $resolver);
+ $sphp->setResponseFormat('object');
+ $ip = $_SERVER['REMOTE_ADDR'];
+ // Uncomment for testing or get one from http://www.projecthoneypot.org/top_harvesters.php
+ // $ip = '209.85.138.136';
+ $status = $sphp->query($ip);
+} catch (Services_ProjectHoneyPot_Exception $e) {
+ report_error($e);
+ $display_form = false;
+}
+
+if ($status && $status->suspicious) {
+ $errors = 'We can not allow you to continue since your IP has been marked suspecious by the
+ http://projecthoneypot.org/, if that was done in error then please contact ' .
+ PEAR_DEV_EMAIL . ' as well as the projecthoneypot people to resolve the issue.';
+ report_error($errors);
+ $display_form = false;
+}
if ($display_form) {
$mailto = '<a href="mailto:' . PEAR_DEV_EMAIL . '">PEAR developers mailing list</a>';