Revision 155
Added by ryan about 19 years ago
trunk/wb/modules/form/view.php | ||
---|---|---|
251 | 251 |
|
252 | 252 |
// Captcha |
253 | 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) {
|
|
254 |
if(isset($_POST['captcha'])) { |
|
255 | 255 |
// User-supplied captcha |
256 | 256 |
$user_captcha = $_POST['captcha']; |
257 | 257 |
// Computer generated |
... | ... | |
260 | 260 |
} |
261 | 261 |
// Check for a mismatch |
262 | 262 |
if($user_captcha != $system_captcha) { |
263 |
exit('Captcha mismatch');
|
|
263 |
$captcha_error = $MESSAGE['INCORRECT_CAPTCHA'];
|
|
264 | 264 |
} else { |
265 | 265 |
unset($_SESSION['captcha']); |
266 | 266 |
} |
... | ... | |
280 | 280 |
echo ':<br /><ul>'; |
281 | 281 |
foreach($required AS $field_title) { |
282 | 282 |
echo '<li>'.$field_title; |
283 |
} |
|
283 |
} |
|
284 |
if(isset($captcha_error)) { echo '<li>'.$captcha_error.'</li>'; } |
|
284 | 285 |
echo '</ul><a href="javascript: history.go(-1);">'.$TEXT['BACK'].'</a>'; |
285 | 286 |
|
286 | 287 |
} else { |
287 | 288 |
|
289 |
if(isset($captcha_error)) { |
|
290 |
echo '<br /><ul>'; |
|
291 |
echo '<li>'.$captcha_error.'</li>'; |
|
292 |
echo '</ul><a href="javascript: history.go(-1);">'.$TEXT['BACK'].'</a>'; |
|
293 |
} else { |
|
294 |
|
|
288 | 295 |
// Check how many times form has been submitted in last hour |
289 | 296 |
$query_submissions = $database->query("SELECT submission_id FROM ".TABLE_PREFIX."mod_form_submissions WHERE submitted_when >= '3600'"); |
290 | 297 |
if($query_submissions->numRows() > $max_submissions) { |
... | ... | |
332 | 339 |
echo $success_message; |
333 | 340 |
} else { |
334 | 341 |
echo $TEXT['ERROR']; |
342 |
} |
|
343 |
|
|
335 | 344 |
} |
336 |
|
|
337 | 345 |
} |
338 | 346 |
|
339 | 347 |
} |
Also available in: Unified diff
Update captcha code on submitting form