Project

General

Profile

« Previous | Next » 

Revision 149

Added by ryan about 19 years ago

Implemented backend captcha code

View differences:

trunk/wb/modules/form/install.php
55 55
	                 . ' `email_from` VARCHAR(255) NOT NULL ,'
56 56
	                 . ' `email_subject` VARCHAR(255) NOT NULL ,'
57 57
	                 . ' `success_message` TEXT NOT NULL ,'
58
						  . ' `stored_submissions` INT NOT NULL,'
59
						  . ' `max_submissions` INT NOT NULL,'
58
					 . ' `stored_submissions` INT NOT NULL,'
59
					 . ' `max_submissions` INT NOT NULL,'
60
					 . ' `use_captcha` INT NOT NULL,'
60 61
	                 . ' PRIMARY KEY ( `section_id` ) )'
61 62
	                 . ' ';
62 63
	$database->query($mod_form);
trunk/wb/modules/form/modify_settings.php
124 124
	<td class="setting_name">
125 125
		<input type="text" name="stored_submissions" style="width: 100%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['stored_submissions'])); ?>" />
126 126
	</td>
127
</tr>
127
</tr>
128
<?php if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */ ?>
129
<tr>
130
	<td class="setting_name"><?php echo $TEXT['USE_CAPTCHA']; ?>:</td>
131
	<td class="setting_name">
132
		<input type="radio" name="use_captcha" id="use_captcha_true" value="true"<?php if($setting['use_captcha'] == true) { echo ' checked'; } ?> />
133
		<label for="use_captcha_true"><?php echo $TEXT['YES']; ?></label>
134
		<input type="radio" name="use_captcha" id="use_captcha_false" value="false"<?php if($setting['use_captcha'] == false) { echo ' checked'; } ?> />
135
		<label for="use_captcha_false"><?php echo $TEXT['NO']; ?></label>
136
	</td>
137
</tr>
138
<?php } ?>
128 139
</table>
129 140
<table cellpadding="0" cellspacing="0" border="0" width="100%">
130 141
<tr>
trunk/wb/modules/form/save_settings.php
62 62
if($max_submissions < $stored_submissions) {
63 63
	$max_submissions = $stored_submissions;
64 64
}
65
// Use Captcha
66
if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */
67
	if(isset($_POST['use_captcha']) AND $_POST['use_captcha'] == "true") {
68
		$use_captcha = true;
69
	} else {
70
		$use_captcha = false;
71
	}
72
} else {
73
	$use_captcha = false;
74
}
65 75

  
66 76
// Update settings
67
$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'");
77
$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'");
68 78

  
69 79
// Check if there is a db error, otherwise say successful
70 80
if($database->is_error()) {
trunk/wb/modules/form/add.php
42 42
$email_subject = 'Results from form on website...';
43 43
$success_message = 'Thank-you.';
44 44
$max_submissions = 50;
45
$stored_submissions = 100;
46
$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) VALUES ('$page_id','$section_id','$header','$field_loop','$footer','$email_to','$email_from','$email_subject','$success_message','$max_submissions','$stored_submissions')");
45
$stored_submissions = 100;
46
if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */
47
	$use_captcha = true;
48
} else {
49
	$use_captcha = false;
50
}
51
$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')");
47 52

  
48 53
?>

Also available in: Unified diff