Project

General

Profile

« Previous | Next » 

Revision 253

Added by ryan over 18 years ago

Added captcha verification to sign-up form

View differences:

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 = '';

Also available in: Unified diff