Project

General

Profile

« Previous | Next » 

Revision 609

Added by thorn almost 17 years ago

Added preview-images for CAPTCHA. Improved security: CAPTCHAS can't be loaded from outside WB

View differences:

tool.php
63 63
	// include captcha-file
64 64
	require_once(WB_PATH .'/include/captcha/captcha.php');
65 65

  
66
// script to load image
67
?>
68
<script type="text/javascript">
69
	var pics = new Array();
70

  
71
	pics["ttf_image"] = new Image();
72
	pics["ttf_image"].src = "<?php echo WB_URL.'/include/captcha/captchas/ttf_image.png'?>";
73

  
74
	pics["calc_image"] = new Image();
75
	pics["calc_image"].src = "<?php echo WB_URL.'/include/captcha/captchas/calc_image.png'?>";
76
	
77
	pics["old_image"] = new Image();
78
	pics["old_image"].src = "<?php echo WB_URL.'/include/captcha/captchas/old_image.png'?>";
79
	
80
	pics["calc_text"] = new Image();
81
	pics["calc_text"].src = "<?php echo WB_URL.'/include/captcha/captchas/calc_text.png'?>";
82

  
83
</script>
84
<?php
85

  
66 86
	// connect to database and read out captcha settings
67 87
	if($query = $database->query("SELECT * FROM $table")) {
68 88
		$data = $query->fetchRow();
......
85 105
<form name="store_settings" action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
86 106
	<table width="98%" cellspacing="0" cellpadding="5px" class="row_a">
87 107
	<tr><td colspan="2"><strong><?php echo $MOD_CAPTCHA_CONTROL['CAPTCHA_CONF'];?>:</strong></td></tr>
88
	<tr>
89
		<td width="35%"><?php echo $MOD_CAPTCHA_CONTROL['CAPTCHA_TYPE'];?>:</td>
108
	<tr><td>
109
		<table>
110
			<tr height="50px">
111
			<td><?php echo $MOD_CAPTCHA_CONTROL['CAPTCHA_TYPE'];?>:</td>
112
			<td align="right" width="150px"><img name="captcha_example" id="captcha_example" src="<?php echo WB_URL.'/include/captcha/captchas/calc_text.png'?>" onload="javascript: document.captcha_example.src = pics[document.store_settings.captcha_type.value].src;"></td>
113
			</tr>
114
		</table>
90 115
		<td>
91
			<select name="captcha_type" id="captcha_type" style="width: 98%;">
116
			<select name="captcha_type" id="captcha_type" onchange="load_captcha_image()" style="width: 98%;">
92 117
			<?php foreach($useable_captchas AS $key=>$text) {
93 118
				echo "<option value=\"$key\" ".($captcha_type==$key?'selected':'').">$text</option>";
94 119
			} ?>

Also available in: Unified diff