Revision 756
Added by thorn about 16 years ago
readme.txt | ||
---|---|---|
20 | 20 |
|
21 | 21 |
|
22 | 22 |
|
23 |
|
|
24 |
One can improve CAPTCHA-type "CAPTCHA with varying fonts and backgrounds" |
|
23 |
One can improve all CAPTCHA-types with varying fonts and backgrounds |
|
25 | 24 |
- by adding backgrounds (PNG-images, 140x40 pixels) to backgrounds/ |
26 | 25 |
- and by adding TrueType-fonts to fonts/ |
27 | 26 |
|
28 | 27 |
|
29 | 28 |
How to use: |
30 |
use |
|
31 |
require_once(WB_PATH.'/include/captcha/captcha.php'); // will output a table with 3 columns: |CAPTCHA|Input|Text|. The calc_image captcha have 4 columns |CAPTCHA|=|Input|Text|. |
|
32 |
and put |
|
33 |
<?php call_captcha(); ?> |
|
34 |
into your form. |
|
35 | 29 |
|
30 |
1.) |
|
31 |
put |
|
32 |
require_once(WB_PATH.'/include/captcha/captcha.php'); |
|
33 |
in your file. |
|
36 | 34 |
|
37 |
The CAPTCHA-code is allways stored in $_SESSION['captcha'] |
|
38 |
The user-input is in $_POST['captcha'] (or $_GET['captcha']). |
|
39 | 35 |
|
40 |
|
|
41 |
call_captcha() will output code like this |
|
36 |
2a.) |
|
37 |
put |
|
38 |
<?php call_captcha(); ?> |
|
39 |
into your form. |
|
40 |
This will output a table with varying columns (3 or 4) like this example: |
|
42 | 41 |
<table class="captcha_table"><tr> |
43 |
<td><img src="<?php echo WB_URL.'/include/captcha/captchas/'.CAPTCHA_TYPE.".php?t=$t"; ?>" alt="Captcha" /></td>
|
|
42 |
<td><img src="http://www.example.org/include/captcha/captchas/ttf.php?t=64241454" alt="Captcha" /></td>
|
|
44 | 43 |
<td><input type="text" name="captcha" maxlength="5" style="width:50px" /></td> |
45 |
<td class="captcha_expl"><?php echo $MOD_CAPTCHA['VERIFICATION_INFO_TEXT']; ?></td>
|
|
44 |
<td class="captcha_expl">Fill in the result</td>
|
|
46 | 45 |
</tr></table> |
46 |
|
|
47 |
|
|
48 |
2b.) |
|
49 |
If you want to use your own layout, use additional parameters to call_captcha(): |
|
50 |
call_captcha('all') will output the whole table as above. |
|
51 |
|
|
52 |
call_captcha('image', $style); will output the <img>-tag for the image only (or the text for an text-style captcha): |
|
53 |
Examples: |
|
54 |
call_captcha('image', 'style="...; title="captcha"'); |
|
55 |
<img style="...; title="captcha" src="http://www.example.org/include/captcha/captchas/captcha.php?t=46784246" /> |
|
56 |
or |
|
57 |
<span style="...; title="captcha">4 add 6</span> |
|
58 |
call_captcha('image'); |
|
59 |
<img src="http://www.example.org/include/captcha/captchas/captcha.php?t=46784246" /> |
|
60 |
or |
|
61 |
4 add 6 |
|
62 |
|
|
63 |
call_captcha('input', $style); will output the input-field: |
|
64 |
call_captcha('input', 'style"...;"'); |
|
65 |
<input type="text" name="captcha" style="...;" /> |
|
66 |
call_captcha('input'); |
|
67 |
<input type="text" name="captcha" style="width:50px;" maxlength="10" /> |
|
68 |
|
|
69 |
call_captcha('text', $style); will output a short "what to do"-text |
|
70 |
call_captcha('text', 'style="...;"'); |
|
71 |
<span style="...;">Fill in the result</span> |
|
72 |
call_captcha('text'); |
|
73 |
Fill in the result |
|
74 |
|
|
75 |
|
|
76 |
|
|
77 |
The CAPTCHA-code is allways stored in $_SESSION['captcha'] for verification with user-input. |
|
78 |
The user-input is in $_POST['captcha'] (or maybe $_GET['captcha']). |
Also available in: Unified diff
call_captcha: added parameter 'style', fixed some issue with parameter 'image' and text-style captchas