Project

General

Profile

« Previous | Next » 

Revision 265

Added by ryan almost 19 years ago

Fixed captcha problems when disabled

View differences:

view.php
211 211
	
212 212
	// Submit form data
213 213
	// First start message settings
214
	$query_settings = $database->query("SELECT email_to,email_from,email_subject,success_message,max_submissions,stored_submissions FROM ".TABLE_PREFIX."mod_form_settings WHERE section_id = '$section_id'");
214
	$query_settings = $database->query("SELECT email_to,email_from,email_subject,success_message,max_submissions,stored_submissions,use_captcha FROM ".TABLE_PREFIX."mod_form_settings WHERE section_id = '$section_id'");
215 215
	if($query_settings->numRows() > 0) {
216 216
		$fetch_settings = $query_settings->fetchRow();
217 217
		$email_to = $fetch_settings['email_to'];
......
223 223
		$email_subject = $fetch_settings['email_subject'];
224 224
		$success_message = $fetch_settings['success_message'];
225 225
		$max_submissions = $fetch_settings['max_submissions'];
226
		$stored_submissions = $fetch_settings['stored_submissions'];
226
		$stored_submissions = $fetch_settings['stored_submissions'];
227
		$use_captcha = $fetch_settings['use_captcha'];
227 228
	} else {
228 229
		exit($TEXT['UNDER_CONSTRUCTION']);
229 230
	}
......
263 264
	
264 265
	// Captcha
265 266
	if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */
266
		if(isset($_POST['captcha']) AND $_POST['captcha'] != ''){
267
			// Check for a mismatch
268
			if(!isset($_POST['captcha']) OR !isset($_SESSION['captcha']) OR $_POST['captcha'] != $_SESSION['captcha']) {
267
		if($use_captcha) {
268
			if(isset($_POST['captcha']) AND $_POST['captcha'] != ''){
269
				// Check for a mismatch
270
				if(!isset($_POST['captcha']) OR !isset($_SESSION['captcha']) OR $_POST['captcha'] != $_SESSION['captcha']) {
271
					$captcha_error = $MESSAGE['MOD_FORM']['INCORRECT_CAPTCHA'];
272
				}
273
			} else {
269 274
				$captcha_error = $MESSAGE['MOD_FORM']['INCORRECT_CAPTCHA'];
270 275
			}
271
		} else {
272
			$captcha_error = $MESSAGE['MOD_FORM']['INCORRECT_CAPTCHA'];
273 276
		}
274 277
	}
275 278
	if(isset($_SESSION['catpcha'])) { unset($_SESSION['captcha']); }

Also available in: Unified diff