Project

General

Profile

« Previous | Next » 

Revision 624

Added by thorn almost 17 years ago

Added Text-CAPTCHA on request. The captcha-text will be stored in temp/.captcha_text.txt

View differences:

tool.php
51 51
		captcha_type = '$captcha_type'
52 52
	");
53 53

  
54
	// save text-captchas
55
	if($_POST['captcha_type'] == 'text') {
56
		$text_qa=$admin->add_slashes($_POST['text_qa']);
57
		if($fh = fopen(WB_PATH.'/temp/.captcha_text.txt', 'wb')) {
58
			fwrite($fh, $text_qa);
59
			fclose($fh);
60
		}
61
	}
62
	
54 63
	// check if there is a database error, otherwise say successful
55 64
	if($database->is_error()) {
56 65
		$admin->print_error($database->get_error(), $js_back);
......
63 72
	// include captcha-file
64 73
	require_once(WB_PATH .'/include/captcha/captcha.php');
65 74

  
75
	// load text-captchas
76
	$text_qa='';
77
	if(file_exists(WB_PATH.'/include/captcha/captchas/text.php')) {
78
		if(file_exists(WB_PATH.'/temp/.captcha_text.txt')) {
79
			@$content = file(WB_PATH.'/temp/.captcha_text.txt');
80
			if($content!==FALSE) {
81
				$text_qa = $admin->strip_slashes(implode('', $content));
82
			}
83
		}
84
	}
85

  
66 86
// script to load image
67 87
?>
68 88
<script type="text/javascript">
......
83 103
	pics["calc_text"] = new Image();
84 104
	pics["calc_text"].src = "<?php echo WB_URL.'/include/captcha/captchas/calc_text.png'?>";
85 105
	
106
	pics["text"] = new Image();
107
	pics["text"].src = "<?php echo WB_URL.'/include/captcha/captchas/text.png'?>";
108

  
86 109
	function load_captcha_image() {
87 110
		document.captcha_example.src = pics[document.store_settings.captcha_type.value].src;
111
		toggle_text_qa();
88 112
	}
113
	
114
	function toggle_text_qa() {
115
		if(document.store_settings.captcha_type.value == 'text' ) {
116
			document.getElementById('text_qa').style.display = '';
117
		} else {
118
			document.getElementById('text_qa').style.display = 'none';
119
		}
120
	}
121

  
89 122
</script>
90 123
<?php
91 124

  
......
126 159
		</select>
127 160
		</td>
128 161
	</tr>
162
	<tr id="text_qa" style="display:<?php if($captcha_type=='text') echo ''; else echo 'none'; ;?>;">
163
		<td class="setting_name"><?php echo $MOD_CAPTCHA_CONTROL['CAPTCHA_ENTER_TEXT'];?>:</td>
164
		<td class="setting_value" colspan="2">
165
			<textarea name="text_qa" wrap="off" cols="50" rows="10"><?php echo $text_qa; ?></textarea>
166
		</td>
167
	</tr>
129 168
	<tr>
130 169
		<td><?php echo $MOD_CAPTCHA_CONTROL['USE_SIGNUP_CAPTCHA'];?>:</td>
131 170
		<td>

Also available in: Unified diff