Project

General

Profile

« Previous | Next » 

Revision 153

Added by ryan about 19 years ago

Updated Captcha code

View differences:

view.php
113 113
$query_settings = $database->query("SELECT header,field_loop,footer FROM ".TABLE_PREFIX."mod_form_settings WHERE section_id = '$section_id'");
114 114
if($query_settings->numRows() > 0) {
115 115
	$fetch_settings = $query_settings->fetchRow();
116
	$header = $fetch_settings['header'];
116
	$header = str_replace('{WB_URL}',WB_URL,$fetch_settings['header']);
117 117
	$field_loop = $fetch_settings['field_loop'];
118
	$footer = $fetch_settings['footer'];
118
	$footer = str_replace('{WB_URL}',WB_URL,$fetch_settings['footer']);
119 119
} else {
120 120
	$header = '';
121 121
	$field_loop = '';
......
249 249
		}
250 250
	}
251 251
	
252
	// Captcha
253
	if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */
254
		if(isset($_POST['captcha']) AND is_numeric($_POST['captcha']) AND strlen($_POST['captcha']) == 5) {
255
			// User-supplied captcha
256
			$user_captcha = $_POST['captcha'];
257
			// Computer generated
258
			if(isset($_SESSION['captcha'])) {
259
				$system_captcha = $_SESSION['captcha'];
260
			}
261
			// Check for a mismatch
262
			if($user_captcha != $system_captcha) {
263
				exit('Captcha mismatch');
264
			} else {
265
				unset($_SESSION['captcha']);
266
			}
267
		}
268
	}
269
	
252 270
	// Addslashes to email body - proposed by Icheb in topic=1170.0
253 271
	// $email_body = $wb->add_slashes($email_body);
254 272
	

Also available in: Unified diff