forked from ferchang/reg8log
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode_verify_captcha.php
More file actions
41 lines (34 loc) · 1.4 KB
/
Copy pathcode_verify_captcha.php
File metadata and controls
41 lines (34 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
if(ini_get('register_globals')) exit("<center><h3>Error: Turn that damned register globals off!</h3></center>");
if(!isset($parent_page)) exit("<center><h3>Error: Direct access denied!</h3></center>");
require_once $index_dir.'include/func/func_captcha.php';
require_once $index_dir.'include/config/config_register_fields.php';
$captcha_format=$fields['captcha'];
require $index_dir.'include/code/sess/code_sess_start.php';
$captcha_verified=false;
if(!isset($_SESSION['captcha_hash'], $_POST['captcha'])) {
$err_msgs[]=$captcha_msg=tr('Sorry, you need to enter a security code.');
$captcha_err=true;
}
else if($_POST['captcha']==='') {
$err_msgs[]=tr('Security code field is empty!');
$captcha_err=true;
}
else if(strlen($_POST['captcha'])<$captcha_format['minlength']) {
$err_msgs[]=sprintf(tr('Security code is shorter than %d characters!'), $captcha_format['minlength']);
$captcha_err=true;
}
else if(strlen($_POST['captcha'])>$captcha_format['maxlength']) {
$err_msgs[]=sprintf(tr('Security code is longer than %d characters!'), $captcha_format['maxlength']);
$captcha_err=true;
}
else if($captcha_format['php_re'] and !preg_match($captcha_format['php_re'], $_POST['captcha'])) {
$err_msgs[]=tr('Security code contains invalid characters!');
$captcha_err=true;
}
else if(!captcha_verify_word()) {
$err_msgs[]=tr('The security code was incorrect!');
$captcha_err=true;
}
else $captcha_verified=true;
?>