Revision 858
Added by thorn about 16 years ago
captcha.php | ||
---|---|---|
23 | 23 |
|
24 | 24 |
*/ |
25 | 25 |
|
26 |
// Must include code to stop this file being accessed directly |
|
26 |
// displays the image or text inside an <iframe> |
|
27 |
function display_captcha_real($kind='image') { |
|
28 |
$t = time(); |
|
29 |
$_SESSION['captcha_time'] = $t; |
|
30 |
if($kind=='image') { |
|
31 |
?><a title="reload" href="<?php echo WB_URL.'/include/captcha/captcha.php?display_captcha_X986E21=2'; ?>"> |
|
32 |
<img style="border: none;" src="<?php echo WB_URL.'/include/captcha/captchas/'.CAPTCHA_TYPE.".php?t=$t"; ?>" alt="Captcha" /> |
|
33 |
</a><?php |
|
34 |
} elseif($kind=='text') { |
|
35 |
?><a style="text-decoration:none;" title="reload" href="<?php echo WB_URL.'/include/captcha/captcha.php?display_captcha_X986E21=2'; ?>"><?php |
|
36 |
include(WB_PATH.'/include/captcha/captchas/'.CAPTCHA_TYPE.'.php'); |
|
37 |
?></a><?php |
|
38 |
} else { |
|
39 |
echo 'error'; |
|
40 |
} |
|
41 |
} |
|
42 |
|
|
43 |
// called from an <iframe> |
|
44 |
if(isset($_GET['display_captcha_X986E21'])) { |
|
45 |
require('../../config.php'); |
|
46 |
switch(CAPTCHA_TYPE) { |
|
47 |
case 'text': |
|
48 |
case 'calc_text': |
|
49 |
display_captcha_real('text'); |
|
50 |
break; |
|
51 |
case 'calc_image': |
|
52 |
case 'calc_ttf_image': |
|
53 |
case 'ttf_image': |
|
54 |
case 'old_image': |
|
55 |
display_captcha_real('image'); |
|
56 |
break; |
|
57 |
} |
|
58 |
exit(0); |
|
59 |
} |
|
60 |
|
|
61 |
|
|
62 |
// Make sure page cannot be accessed directly |
|
27 | 63 |
if(!defined('WB_PATH')) { exit("Cannot access this file directly"); } |
28 | 64 |
|
29 | 65 |
// check if module language file exists for the language set by the user (e.g. DE, EN) |
... | ... | |
78 | 114 |
global $MOD_CAPTCHA; |
79 | 115 |
$t = time(); |
80 | 116 |
$_SESSION['captcha_time'] = $t; |
81 |
|
|
117 |
|
|
118 |
// get width and height of captcha image or text for use in <iframe> |
|
119 |
switch(CAPTCHA_TYPE) { |
|
120 |
case 'text': |
|
121 |
$captcha_width = 250; |
|
122 |
$captcha_height = 100; |
|
123 |
break; |
|
124 |
case 'calc_text': |
|
125 |
$captcha_width = 120; |
|
126 |
$captcha_height = 20; |
|
127 |
break; |
|
128 |
case 'calc_image': |
|
129 |
$captcha_width = 142; |
|
130 |
$captcha_height = 30; |
|
131 |
break; |
|
132 |
case 'calc_ttf_image': |
|
133 |
$captcha_width = 162; |
|
134 |
$captcha_height = 40; |
|
135 |
break; |
|
136 |
case 'ttf_image': |
|
137 |
$captcha_width = 162; |
|
138 |
$captcha_height = 40; |
|
139 |
break; |
|
140 |
case 'old_image': |
|
141 |
$captcha_width = 142; |
|
142 |
$captcha_height = 30; |
|
143 |
break; |
|
144 |
default: |
|
145 |
$captcha_width = 250; |
|
146 |
$captcha_height = 100; |
|
147 |
} |
|
148 |
|
|
82 | 149 |
if($action=='all') { |
83 | 150 |
switch(CAPTCHA_TYPE) { |
84 | 151 |
// one special case |
85 |
case 'text': // text-captcha |
|
152 |
case 'text': // text-captcha - we don't use an <iframe> in this case
|
|
86 | 153 |
?><table class="captcha_table"><tr> |
87 |
<td class="text_captcha"><?php include(WB_PATH.'/include/captcha/captchas/'.CAPTCHA_TYPE.'.php'); ?></td> |
|
154 |
<td class="text_captcha"> |
|
155 |
<?php include(WB_PATH.'/include/captcha/captchas/'.CAPTCHA_TYPE.'.php'); ?> |
|
156 |
</td> |
|
157 |
<td></td> |
|
88 | 158 |
<td><input type="text" name="captcha" maxlength="50" style="width:150px;" /></td> |
89 | 159 |
<td class="captcha_expl"><?php echo $MOD_CAPTCHA['VERIFICATION_INFO_QUEST']; ?></td> |
90 | 160 |
</tr></table><?php |
... | ... | |
92 | 162 |
// two special cases |
93 | 163 |
case 'calc_text': // calculation as text |
94 | 164 |
?><table class="captcha_table"><tr> |
95 |
<td class="text_captcha"><?php include(WB_PATH.'/include/captcha/captchas/'.CAPTCHA_TYPE.'.php'); ?> = </td> |
|
165 |
<td class="text_captcha"> |
|
166 |
<iframe class="captcha_iframe" width="<?php echo $captcha_width; ?>" height="<?php echo $captcha_height; ?>" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" name="captcha_iframe" src="<?php echo WB_URL.'/include/captcha/captcha.php?display_captcha_X986E21=1'; ?>"> |
|
167 |
<?php include(WB_PATH.'/include/captcha/captchas/'.CAPTCHA_TYPE.'.php'); ?> |
|
168 |
</iframe> |
|
169 |
</td> |
|
170 |
<td> = </td> |
|
96 | 171 |
<td><input type="text" name="captcha" maxlength="10" style="width:20px;" /></td> |
97 | 172 |
<td class="captcha_expl"><?php echo $MOD_CAPTCHA['VERIFICATION_INFO_RES']; ?></td> |
98 | 173 |
</tr></table><?php |
99 | 174 |
break; |
100 | 175 |
case 'calc_image': // calculation with image (old captcha) |
101 | 176 |
case 'calc_ttf_image': // calculation with varying background and ttf-font |
102 |
?><table class="captcha_table"><tr> |
|
103 |
<td class="image_captcha"><img src="<?php echo WB_URL.'/include/captcha/captchas/'.CAPTCHA_TYPE.".php?t=$t"; ?>" alt="Captcha" /></td><td> = </td> |
|
177 |
?><table class="captcha_table"><tr> |
|
178 |
<td class="image_captcha"> |
|
179 |
<iframe class="captcha_iframe" width="<?php echo $captcha_width; ?>" height="<?php echo $captcha_height; ?>" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" name="captcha_iframe" src="<?php echo WB_URL.'/include/captcha/captcha.php?display_captcha_X986E21=1'; ?>"> |
|
180 |
<img src="<?php echo WB_URL.'/include/captcha/captchas/'.CAPTCHA_TYPE.".php?t=$t"; ?>" alt="Captcha" /> |
|
181 |
</iframe> |
|
182 |
</td> |
|
183 |
<td> = </td> |
|
104 | 184 |
<td><input type="text" name="captcha" maxlength="10" style="width:20px;" /></td> |
105 | 185 |
<td class="captcha_expl"><?php echo $MOD_CAPTCHA['VERIFICATION_INFO_RES']; ?></td> |
106 | 186 |
</tr></table><?php |
... | ... | |
109 | 189 |
case 'ttf_image': // captcha with varying background and ttf-font |
110 | 190 |
case 'old_image': // old captcha |
111 | 191 |
?><table class="captcha_table"><tr> |
112 |
<td class="image_captcha"><img src="<?php echo WB_URL.'/include/captcha/captchas/'.CAPTCHA_TYPE.".php?t=$t"; ?>" alt="Captcha" /></td> |
|
192 |
<td class="image_captcha"> |
|
193 |
<iframe class="captcha_iframe" width="<?php echo $captcha_width; ?>" height="<?php echo $captcha_height; ?>" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" name="captcha_iframe" src="<?php echo WB_URL.'/include/captcha/captcha.php?display_captcha_X986E21=1'; ?>"> |
|
194 |
<img src="<?php echo WB_URL.'/include/captcha/captchas/'.CAPTCHA_TYPE.".php?t=$t"; ?>" alt="Captcha" /> |
|
195 |
</iframe> |
|
196 |
</td> |
|
197 |
<td></td> |
|
113 | 198 |
<td><input type="text" name="captcha" maxlength="10" style="width:50px;" /></td> |
114 | 199 |
<td class="captcha_expl"><?php echo $MOD_CAPTCHA['VERIFICATION_INFO_TEXT']; ?></td> |
115 | 200 |
</tr></table><?php |
... | ... | |
130 | 215 |
echo "<img $style src=\"".WB_URL.'/include/captcha/captchas/'.CAPTCHA_TYPE.".php?t=$t\" />"; |
131 | 216 |
break; |
132 | 217 |
} |
218 |
} elseif($action=='image_iframe') { |
|
219 |
switch(CAPTCHA_TYPE) { |
|
220 |
case 'text': // text-captcha |
|
221 |
echo ($style?"<span $style>":''); |
|
222 |
include(WB_PATH.'/include/captcha/captchas/'.CAPTCHA_TYPE.'.php'); |
|
223 |
echo ($style?'</span>':''); |
|
224 |
break; |
|
225 |
case 'calc_text': // calculation as text |
|
226 |
?><iframe class="captcha_iframe" width="<?php echo $captcha_width; ?>" height="<?php echo $captcha_height; ?>" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" name="captcha_iframe" src="<?php echo WB_URL.'/include/captcha/captcha.php?display_captcha_X986E21=1'; ?>"><?php |
|
227 |
include(WB_PATH.'/include/captcha/captchas/'.CAPTCHA_TYPE.'.php'); |
|
228 |
?></iframe><?php |
|
229 |
break; |
|
230 |
case 'calc_image': // calculation with image (old captcha) |
|
231 |
case 'calc_ttf_image': // calculation with varying background and ttf-font |
|
232 |
case 'ttf_image': // captcha with varying background and ttf-font |
|
233 |
case 'old_image': // old captcha |
|
234 |
?><iframe class="captcha_iframe" width="<?php echo $captcha_width; ?>" height="<?php echo $captcha_height; ?>" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" name="captcha_iframe" src="<?php echo WB_URL.'/include/captcha/captcha.php?display_captcha_X986E21=1'; ?>"><?php |
|
235 |
echo "<img $style alt=\"Captcha\" src=\"".WB_URL.'/include/captcha/captchas/'.CAPTCHA_TYPE.".php?t=$t\" />"; |
|
236 |
?></iframe><?php |
|
237 |
break; |
|
238 |
} |
|
133 | 239 |
} elseif($action=='input') { |
134 | 240 |
switch(CAPTCHA_TYPE) { |
135 | 241 |
case 'text': // text-captcha |
... | ... | |
165 | 271 |
} |
166 | 272 |
} |
167 | 273 |
} |
168 |
?> |
|
274 |
|
Also available in: Unified diff
Added captcha-reload