Revision 615
Added by thorn almost 17 years ago
captcha.php | ||
---|---|---|
23 | 23 |
|
24 | 24 |
*/ |
25 | 25 |
|
26 |
/* CAPTCHA - How to use: |
|
27 |
* use |
|
28 |
* require_once(WB_PATH.'/include/captcha/captcha.php'); |
|
29 |
* and put |
|
30 |
* <?php call_captcha(); ?> |
|
31 |
* into your form. |
|
32 |
* |
|
33 |
* captcha-code is in $_SESSION['captcha'] |
|
34 |
* user input in $_POST['captcha'] |
|
35 |
*/ |
|
36 |
|
|
37 | 26 |
// Must include code to stop this file being accessed directly |
38 | 27 |
if(!defined('WB_PATH')) { exit("Cannot access this file directly"); } |
39 | 28 |
|
... | ... | |
70 | 59 |
$useable_captchas = array( |
71 | 60 |
'calc_text'=>$MOD_CAPTCHA_CONTROL['CALC_TEXT'], |
72 | 61 |
'calc_image'=>$MOD_CAPTCHA_CONTROL['CALC_IMAGE'], |
62 |
'calc_ttf_image'=>$MOD_CAPTCHA_CONTROL['CALC_TTF_IMAGE'], |
|
73 | 63 |
'ttf_image'=>$MOD_CAPTCHA_CONTROL['TTF_IMAGE'], |
74 | 64 |
'old_image'=>$MOD_CAPTCHA_CONTROL['OLD_IMAGE'] |
75 | 65 |
); |
... | ... | |
94 | 84 |
switch(CAPTCHA_TYPE) { |
95 | 85 |
// two special cases |
96 | 86 |
case 'calc_text': // calculation as text |
97 |
?> |
|
98 |
<?php include(WB_PATH.'/include/captcha/captchas/calc_text.php'); ?> = |
|
99 |
<input type="text" name="captcha" maxlength="5" style="width:20px" /> <?php echo $MOD_CAPTCHA['VERIFICATION_INFO_RES']; ?></font> |
|
100 |
<?php |
|
87 |
?><table class="captcha_table"><tr> |
|
88 |
<td><?php include(WB_PATH.'/include/captcha/captchas/calc_text.php'); ?> = </td> |
|
89 |
<td><input type="text" name="captcha" maxlength="5" style="width:20px" /></td> |
|
90 |
<td class="captcha_expl"><?php echo $MOD_CAPTCHA['VERIFICATION_INFO_RES']; ?></td> |
|
91 |
</tr></table><?php |
|
101 | 92 |
break; |
102 | 93 |
case 'calc_image': // calculation with image (old captcha) |
103 |
?> |
|
104 |
<img src="<?php echo WB_URL."/include/captcha/captchas/calc_image.php?t=$t"; ?>" align="middle" alt="Captcha" /> = |
|
105 |
<input type="text" name="captcha" maxlength="5" style="width:20px" /> <?php echo $MOD_CAPTCHA['VERIFICATION_INFO_RES']; ?></font> |
|
106 |
<?php |
|
94 |
?><table class="captcha_table"><tr> |
|
95 |
<td><img src="<?php echo WB_URL."/include/captcha/captchas/calc_image.php?t=$t"; ?>" alt="Captcha" /> = </td> |
|
96 |
<td><input type="text" name="captcha" maxlength="5" style="width:20px" /></td> |
|
97 |
<td class="captcha_expl"><?php echo $MOD_CAPTCHA['VERIFICATION_INFO_RES']; ?></td> |
|
98 |
</tr></table><?php |
|
107 | 99 |
break; |
108 | 100 |
// normal images |
109 | 101 |
case 'ttf_image': // captcha with varying background and ttf-font |
102 |
case 'calc_ttf_image': // calculation with varying background and ttf-font |
|
110 | 103 |
case 'old_image': // old captcha |
111 |
?> |
|
112 |
<img src="<?php echo WB_URL.'/include/captcha/captchas/'.CAPTCHA_TYPE.".php?t=$t"; ?>" align="middle" alt="Captcha" /> |
|
113 |
<input type="text" name="captcha" maxlength="5" style="width:50px" /> <?php echo $MOD_CAPTCHA['VERIFICATION_INFO_TEXT']; ?></font> |
|
114 |
<?php |
|
104 |
?><table class="captcha_table"><tr> |
|
105 |
<td><img src="<?php echo WB_URL.'/include/captcha/captchas/'.CAPTCHA_TYPE.".php?t=$t"; ?>" alt="Captcha" /></td> |
|
106 |
<td><input type="text" name="captcha" maxlength="5" style="width:50px" /></td> |
|
107 |
<td class="captcha_expl"><?php echo $MOD_CAPTCHA['VERIFICATION_INFO_TEXT']; ?></td> |
|
108 |
</tr></table><?php |
|
115 | 109 |
break; |
116 | 110 |
} |
117 | 111 |
} |
118 | 112 |
} |
119 |
?> |
|
113 |
?> |
Also available in: Unified diff
Added new CAPTCHA (calc_ttf_image). Changed call_captcha() to output a table-layout. Some minor changes to captcha-code.