20 |
20 |
if(defined('WB_PATH') == false)
|
21 |
21 |
{
|
22 |
22 |
// Stop this file being access directly
|
23 |
|
die('<head><title>Access denied</title></head><body><h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2></body></html>');
|
|
23 |
die('<h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2>');
|
24 |
24 |
}
|
25 |
25 |
/* -------------------------------------------------------- */
|
26 |
26 |
|
... | ... | |
43 |
43 |
if(!$admin_header) { $admin->print_header(); }
|
44 |
44 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], $js_back );
|
45 |
45 |
}
|
46 |
|
|
|
46 |
|
|
47 |
$ct_text = '';
|
|
48 |
$captcha_type = 'calc_text';
|
47 |
49 |
// get configuration settings
|
48 |
50 |
$enabled_captcha = ($_POST['enabled_captcha'] == '1') ? '1' : '0';
|
49 |
51 |
$enabled_asp = ($_POST['enabled_asp'] == '1') ? '1' : '0';
|
50 |
52 |
$captcha_type = $admin->add_slashes($_POST['captcha_type']);
|
51 |
|
|
52 |
|
// update database settings
|
53 |
|
$database->query("UPDATE $table SET
|
54 |
|
enabled_captcha = '$enabled_captcha',
|
55 |
|
enabled_asp = '$enabled_asp',
|
56 |
|
captcha_type = '$captcha_type'
|
57 |
|
");
|
58 |
|
|
59 |
53 |
// save text-captchas
|
60 |
54 |
if($captcha_type == 'text') { // ct_text
|
61 |
55 |
$text_qa=$admin->add_slashes($_POST['text_qa']);
|
62 |
56 |
if(!preg_match('/### .*? ###/', $text_qa)) {
|
63 |
|
$database->query("UPDATE $table SET ct_text = '$text_qa'");
|
|
57 |
$ct_text = $text_qa;
|
64 |
58 |
}
|
65 |
59 |
}
|
66 |
|
|
|
60 |
|
|
61 |
|
|
62 |
// update database settings
|
|
63 |
|
|
64 |
$sql = 'UPDATE '.$table.' ';
|
|
65 |
$sql .= 'SET `enabled_captcha` = \''.$enabled_captcha.'\', ';
|
|
66 |
$sql .= '`enabled_asp` = \''.$enabled_asp.'\', ';
|
|
67 |
$sql .= '`captcha_type` = \''.$captcha_type.'\', ';
|
|
68 |
$sql .= '`asp_session_min_age` = 20, ';
|
|
69 |
$sql .= '`asp_view_min_age` = 10, ';
|
|
70 |
$sql .= '`asp_input_min_age` = 5, ';
|
|
71 |
$sql .= '`ct_text` =\''.$ct_text.'\' ';
|
|
72 |
|
|
73 |
if(!$database->query($sql)) {
|
|
74 |
// print '<pre style="text-align: left;"><strong>function '.__FUNCTION__.'( '.''.' );</strong> basename: '.basename(__FILE__).' line: '.__LINE__.' -> <br />';
|
|
75 |
// print_r( explode(',',$sql) ); print '</pre>'; // flush ();sleep(10); die();
|
|
76 |
}
|
|
77 |
|
67 |
78 |
// check if there is a database error, otherwise say successful
|
68 |
79 |
if(!$admin_header) { $admin->print_header(); }
|
69 |
80 |
if($database->is_error()) {
|
... | ... | |
74 |
85 |
|
75 |
86 |
} else {
|
76 |
87 |
}
|
77 |
|
|
|
88 |
|
78 |
89 |
// include captcha-file
|
79 |
90 |
require_once(WB_PATH .'/include/captcha/captcha.php');
|
80 |
91 |
|
... | ... | |
103 |
114 |
|
104 |
115 |
pics["old_image"] = new Image();
|
105 |
116 |
pics["old_image"].src = "<?php echo WB_URL.'/include/captcha/captchas/old_image.png'?>";
|
106 |
|
|
|
117 |
|
107 |
118 |
pics["calc_text"] = new Image();
|
108 |
119 |
pics["calc_text"].src = "<?php echo WB_URL.'/include/captcha/captchas/calc_text.png'?>";
|
109 |
|
|
|
120 |
|
110 |
121 |
pics["text"] = new Image();
|
111 |
122 |
pics["text"].src = "<?php echo WB_URL.'/include/captcha/captchas/text.png'?>";
|
112 |
123 |
|
... | ... | |
114 |
125 |
document.captcha_example.src = pics[document.store_settings.captcha_type.value].src;
|
115 |
126 |
toggle_text_qa();
|
116 |
127 |
}
|
117 |
|
|
|
128 |
|
118 |
129 |
function toggle_text_qa() {
|
119 |
130 |
if(document.store_settings.captcha_type.value == 'text' ) {
|
120 |
131 |
document.getElementById('text_qa').style.display = '';
|
... | ... | |
138 |
149 |
$enabled_asp = '1';
|
139 |
150 |
$captcha_type = 'calc_text';
|
140 |
151 |
}
|
141 |
|
|
|
152 |
|
142 |
153 |
// write out heading
|
143 |
154 |
echo '<h2>' .$MOD_CAPTCHA_CONTROL['HEADING'] .'</h2>';
|
144 |
155 |
|