[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    www/areas/worldwide
From:       Tom Albers <tomalbers () kde ! nl>
Date:       2008-07-08 19:27:46
Message-ID: 1215545266.093285.6655.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 829645 by toma:

Protect these forms with captcha's as they are found by spambots currently. Totally \
untested.


 M  +23 -0     form.php  
 M  +25 -0     map/form.php  
 A             recaptchalib.php  


--- trunk/www/areas/worldwide/form.php #829644:829645
@@ -6,6 +6,7 @@
   $site_root='./';
   include("worldwide.inc");
   include("header.inc");
+  require_once('recaptchalib.php');
 ?>
 
 <?php
@@ -26,6 +27,17 @@
 
 if ( $submitted == true ) {
 
+$privatekey = "6LeBuAEAAAAAAETENewMQrWxPF0-k9j3W29sfLxi";
+$resp = recaptcha_check_answer($privatekey,
+                               $_SERVER["REMOTE_ADDR"],
+                               $_POST["recaptcha_challenge_field"],
+                               $_POST["recaptcha_response_field"]);
+
+if ( !$resp->is_valid ) {
+    $error = true;
+    echo "<p>The captcha was incorrect</p>";
+}
+
 if ( !ereg( "^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}", \
$email ) ) {  $error = true;
 	$error_email = true;
@@ -233,6 +245,17 @@
 	<tr><td colspan="2"><p>&nbsp;</p></td></tr>
 
 	<tr>
+		<td><strong>Are you human?</strong></td>
+		<td><?php
+            $publickey = "6LeBuAEAAAAAAJNac4b5bRI-Q4vgCNQgKO9swZ2D"; 
+            echo recaptcha_get_html($publickey, null, true); 
+            ?></td>
+	</tr>
+	<tr><td></td><td>To prevent bots submitting this form and spamming us, we ask you \
to type in the two words. The words below come from scanned books. By typing them, \
you also help to digitize old texts. Visually impaired users can click the audio \
button to hear a set of digits that can be entered instead of the visual challenge.  \
</td> +	</tr>
+
+	<tr><td colspan="2"><p>&nbsp;</p></td></tr>
+	<tr>
 		<td colspan="2">
 			<input type="submit" value="Send to Maintainer" />
 			<input type="reset" value="Reset Form" />
--- trunk/www/areas/worldwide/map/form.php #829644:829645
@@ -3,6 +3,7 @@
   $site_root='../';
   include("events.inc");
   include("header.inc");
+  require_once('../recaptchalib.php');
 ?>
 
 <?php
@@ -20,6 +21,18 @@
 
 if ($submitted == true)
 {
+
+$privatekey = "6LeBuAEAAAAAAETENewMQrWxPF0-k9j3W29sfLxi";
+$resp = recaptcha_check_answer($privatekey,
+                               $_SERVER["REMOTE_ADDR"],
+                               $_POST["recaptcha_challenge_field"],
+                               $_POST["recaptcha_response_field"]);
+
+if ( !$resp->is_valid ) {
+    echo "<p>The captcha was incorrect, go back and try again</p>";
+    exit;
+}
+
 echo "<p>You have provided the following details:</p>";
 
 $mailbody = $email . " " . "\n\n" . $lat . "\t" . $long . "\t" . $fullname . "\t" . \
$nick . "\t" . $town . "\t" . $country . "\t" . $sex . "\t" . $anon . "\n\n" . $job; \
@@ -111,8 +124,20 @@  <tr><td><label for="job">Job:</label></td>
 <td><input type="text" id="job" name="job" size="20" maxlength="40" /></td></tr>
 
+<tr><td colspan="2"><p>&nbsp;</p></td></tr>
 
+<tr> <td><strong>Are you human?</strong></td>
+<td><?php
+        $publickey = "6LeBuAEAAAAAAJNac4b5bRI-Q4vgCNQgKO9swZ2D";
+        echo recaptcha_get_html($publickey, null, true);
+    ?></td>
+</tr>
 
+<tr><td></td><td>To prevent bots submitting this form and spamming us, we ask you to \
type in the two words. The words below come from scanned books. By typing them, you \
also help to digitize old texts. Visually impaired users canclick the audio button to \
hear a set of digits that can be entered instead of the visual challenge.  </td> +    \
</tr> +
+
+
 <tr><td colspan="2"><p>&nbsp;</p></td></tr>
 
 <tr><td colspan="2">


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic