Project

General

Profile

« Previous | Next » 

Revision 253

Added by ryan about 19 years ago

Added captcha verification to sign-up form

View differences:

trunk/wb/admin/settings/index.php
319 319
} else {
320 320
	$template->set_var('CAPTCHA_VERIFICATION_DISABLED', ' checked');
321 321
}
322
if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */
323
	$template->set_var('GD_EXTENSION_ENABLED', '');
324
} else {
325
	$template->set_var('GD_EXTENSION_ENABLED', 'none');
326
}
322 327

  
323 328
// Work-out if section blocks feature is enabled
324 329
if(defined('SECTION_BLOCKS') AND SECTION_BLOCKS == true) {
trunk/wb/admin/settings/template.html
176 176
		<label for="smart_login_false">{TEXT_DISABLED}</label>
177 177
	</td>
178 178
</tr>
179
<tr class="advanced">
179
<tr class="advanced" style="display: {GD_EXTENSION_LOADED};">
180 180
	<td class="setting_name">{TEXT_CAPTCHA_VERIFICATION}:</td>
181 181
	<td class="setting_value" colspan="2">
182 182
		<input type="radio" name="captcha_verification" id="captcha_verification_true" style="width: 14px; height: 14px;" value="true"{CAPTCHA_VERIFICATION_ENABLED} />
trunk/wb/account/signup2.php
27 27
	header('Location: ../pages/index.php');
28 28
}
29 29

  
30
require_once(WB_PATH.'/framework/class.admin.php');
31
$admin = new admin('Start', 'start', false, false);
32

  
30 33
// Create new database object
31 34
$database = new database();
32 35

  
......
54 57
} else {
55 58
	$admin->print_error($MESSAGE['SIGNUP']['NO_EMAIL'], $js_back);
56 59
}
60
// Captcha
61
if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */
62
	if(isset($_POST['captcha']) AND $_POST['captcha'] != ''){
63
		// Check for a mismatch
64
		if(!isset($_POST['captcha']) OR !isset($_SESSION['captcha']) OR $_POST['captcha'] != $_SESSION['captcha']) {
65
			$admin->print_error($MESSAGE['MOD_FORM']['INCORRECT_CAPTCHA'], $js_back);
66
		}
67
	} else {
68
		$admin->print_error($MESSAGE['MOD_FORM']['INCORRECT_CAPTCHA'], $js_back);
69
	}
70
}
71
if(isset($_SESSION['catpcha'])) { unset($_SESSION['captcha']); }
57 72

  
58 73
// Generate a random password then update the database with it
59 74
$new_pass = '';
trunk/wb/account/signup_form.php
1 1
<?php
2 2

  
3
// $Id: signup_form.php,v 1.2 2005/04/08 07:36:57 rdjurovich Exp $
3
// $Id$
4 4

  
5 5
/*
6 6

  
......
58 58
		<input type="text" name="email" maxlength="255" />
59 59
	</td>
60 60
</tr>
61
<?php
62
// Captcha
63
if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */
64
	if(CAPTCHA_VERIFICATION == true) {
65
		$_SESSION['captcha'] = '';
66
		for($i = 0; $i < 5; $i++) {
67
			$_SESSION['captcha'] .= rand(0,9);
68
		}
69
		?><tr><td class="field_title"><?php echo $TEXT['VERIFICATION']; ?>:</td><td>
70
		<table cellpadding="2" cellspacing="0" border="0">
71
		<tr><td><img src="<?php echo WB_URL; ?>/include/captcha.php" alt="Captcha" /></td>
72
		<td><input type="text" name="captcha" maxlength="5" /></td>
73
		</tr></table>
74
		</td></tr>
75
		<?php
76
	}
77
}
78
?>
61 79
<tr>
62 80
	<td>&nbsp;</td>
63 81
	<td>

Also available in: Unified diff