Index: trunk/wb/modules/form/install.php
===================================================================
--- trunk/wb/modules/form/install.php	(revision 152)
+++ trunk/wb/modules/form/install.php	(revision 153)
@@ -56,8 +56,7 @@
 	                 . ' `email_subject` VARCHAR(255) NOT NULL ,'
 	                 . ' `success_message` TEXT NOT NULL ,'
 					 . ' `stored_submissions` INT NOT NULL,'
-					 . ' `max_submissions` INT NOT NULL,'
-					 . ' `use_captcha` INT NOT NULL,'
+					 . ' `max_submissions` INT NOT NULL,'
 	                 . ' PRIMARY KEY ( `section_id` ) )'
 	                 . ' ';
 	$database->query($mod_form);
Index: trunk/wb/modules/form/modify_settings.php
===================================================================
--- trunk/wb/modules/form/modify_settings.php	(revision 152)
+++ trunk/wb/modules/form/modify_settings.php	(revision 153)
@@ -124,18 +124,7 @@
 	<td class="setting_name">
 		<input type="text" name="stored_submissions" style="width: 100%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['stored_submissions'])); ?>" />
 	</td>
-</tr>
-<?php if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */ ?>
-<tr>
-	<td class="setting_name"><?php echo $TEXT['USE_CAPTCHA']; ?>:</td>
-	<td class="setting_name">
-		<input type="radio" name="use_captcha" id="use_captcha_true" value="true"<?php if($setting['use_captcha'] == true) { echo ' checked'; } ?> />
-		<label for="use_captcha_true"><?php echo $TEXT['YES']; ?></label>
-		<input type="radio" name="use_captcha" id="use_captcha_false" value="false"<?php if($setting['use_captcha'] == false) { echo ' checked'; } ?> />
-		<label for="use_captcha_false"><?php echo $TEXT['NO']; ?></label>
-	</td>
-</tr>
-<?php } ?>
+</tr>
 </table>
 <table cellpadding="0" cellspacing="0" border="0" width="100%">
 <tr>
Index: trunk/wb/modules/form/view.php
===================================================================
--- trunk/wb/modules/form/view.php	(revision 152)
+++ trunk/wb/modules/form/view.php	(revision 153)
@@ -113,9 +113,9 @@
 $query_settings = $database->query("SELECT header,field_loop,footer FROM ".TABLE_PREFIX."mod_form_settings WHERE section_id = '$section_id'");
 if($query_settings->numRows() > 0) {
 	$fetch_settings = $query_settings->fetchRow();
-	$header = $fetch_settings['header'];
+	$header = str_replace('{WB_URL}',WB_URL,$fetch_settings['header']);
 	$field_loop = $fetch_settings['field_loop'];
-	$footer = $fetch_settings['footer'];
+	$footer = str_replace('{WB_URL}',WB_URL,$fetch_settings['footer']);
 } else {
 	$header = '';
 	$field_loop = '';
@@ -249,6 +249,24 @@
 		}
 	}
 	
+	// Captcha
+	if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */
+		if(isset($_POST['captcha']) AND is_numeric($_POST['captcha']) AND strlen($_POST['captcha']) == 5) {
+			// User-supplied captcha
+			$user_captcha = $_POST['captcha'];
+			// Computer generated
+			if(isset($_SESSION['captcha'])) {
+				$system_captcha = $_SESSION['captcha'];
+			}
+			// Check for a mismatch
+			if($user_captcha != $system_captcha) {
+				exit('Captcha mismatch');
+			} else {
+				unset($_SESSION['captcha']);
+			}
+		}
+	}
+	
 	// Addslashes to email body - proposed by Icheb in topic=1170.0
 	// $email_body = $wb->add_slashes($email_body);
 	
Index: trunk/wb/modules/form/save_settings.php
===================================================================
--- trunk/wb/modules/form/save_settings.php	(revision 152)
+++ trunk/wb/modules/form/save_settings.php	(revision 153)
@@ -61,20 +61,10 @@
 // Make sure max submissions is not smaller than stored submissions
 if($max_submissions < $stored_submissions) {
 	$max_submissions = $stored_submissions;
-}
-// Use Captcha
-if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */
-	if(isset($_POST['use_captcha']) AND $_POST['use_captcha'] == "true") {
-		$use_captcha = true;
-	} else {
-		$use_captcha = false;
-	}
-} else {
-	$use_captcha = false;
 }
 
 // Update settings
-$database->query("UPDATE ".TABLE_PREFIX."mod_form_settings SET header = '$header', field_loop = '$field_loop', footer = '$footer', email_to = '$email_to', email_from = '$email_from', email_subject = '$email_subject', success_message = '$success_message', max_submissions = '$max_submissions', stored_submissions = '$stored_submissions', use_captcha = '$use_captcha' WHERE section_id = '$section_id'");
+$database->query("UPDATE ".TABLE_PREFIX."mod_form_settings SET header = '$header', field_loop = '$field_loop', footer = '$footer', email_to = '$email_to', email_from = '$email_from', email_subject = '$email_subject', success_message = '$success_message', max_submissions = '$max_submissions', stored_submissions = '$stored_submissions' WHERE section_id = '$section_id'");
 
 // Check if there is a db error, otherwise say successful
 if($database->is_error()) {
Index: trunk/wb/modules/form/add.php
===================================================================
--- trunk/wb/modules/form/add.php	(revision 152)
+++ trunk/wb/modules/form/add.php	(revision 153)
@@ -30,12 +30,22 @@
 
 // Insert an extra rows into the database
 $header = '<table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" width=\"100%\">';
-$field_loop = '<tr><td class=\"field_title\">{TITLE}{REQUIRED}:</td><td>{FIELD}</td></tr>';
-$footer = '<tr><td>&nbsp;</td>
-<td>
-<input type=\"submit\" name=\"submit\" value=\"Submit Form\" />
-</td>
-</tr>
+$field_loop = '<tr><td class=\"field_title\">{TITLE}{REQUIRED}:</td><td>{FIELD}</td></tr>';
+$footer = '';
+if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */
+$footer .= '<tr><td class=\"field_title\">Verification:</td><td>
+<table cellpadding=\"2\" cellspacing=\"0\" border=\"0\">
+<tr><td><img src=\"{WB_URL}/include/captcha.php\" alt=\"Captcha\" /></td>
+<td><input type=\"text\" name=\"captcha\" maxlength=\"5\" /></td>
+</tr></table>
+</td></tr>
+';
+}
+$footer .= '<tr><td>&nbsp;</td>
+<td>
+<input type=\"submit\" name=\"submit\" value=\"Submit Form\" />
+</td>
+</tr>
 </table>';
 $email_to = $admin->get_email();
 $email_from = '';
@@ -43,11 +53,6 @@
 $success_message = 'Thank-you.';
 $max_submissions = 50;
 $stored_submissions = 100;
-if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */
-	$use_captcha = true;
-} else {
-	$use_captcha = false;
-}
 $database->query("INSERT INTO ".TABLE_PREFIX."mod_form_settings (page_id,section_id,header,field_loop,footer,email_to,email_from,email_subject,success_message,max_submissions,stored_submissions,use_captcha) VALUES ('$page_id','$section_id','$header','$field_loop','$footer','$email_to','$email_from','$email_subject','$success_message','$max_submissions','$stored_submissions','$use_captcha')");
 
 ?>
\ No newline at end of file
