Project

General

Profile

1 596 thorn
// $Id$
2
3
4
 Website Baker Project <http://www.websitebaker.org/>
5
 Copyright (C) 2004-2008, Ryan Djurovich
6
7
 Website Baker is free software; you can redistribute it and/or modify
8
 it under the terms of the GNU General Public License as published by
9
 the Free Software Foundation; either version 2 of the License, or
10
 (at your option) any later version.
11
12
 Website Baker is distributed in the hope that it will be useful,
13
 but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 GNU General Public License for more details.
16
17
 You should have received a copy of the GNU General Public License
18
 along with Website Baker; if not, write to the Free Software
19
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
21
22
23
24
One can improve CAPTCHA-type "CAPTCHA with varying fonts and backgrounds"
25
- by adding backgrounds (PNG-images, 140x40 pixels) to backgrounds/
26
- and by adding TrueType-fonts to fonts/
27
28
29 615 thorn
How to use:
30
use
31 619 thorn
	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 615 thorn
and put
33
	<?php call_captcha(); ?>
34
into your form.
35 596 thorn
36 615 thorn
37
The CAPTCHA-code is allways stored in $_SESSION['captcha']
38
The user-input is in $_POST['captcha'] (or $_GET['captcha']).
39
40
41
call_captcha() will output code like this
42
<table class="captcha_table"><tr>
43
  <td><img src="<?php echo WB_URL.'/include/captcha/captchas/'.CAPTCHA_TYPE.".php?t=$t"; ?>" alt="Captcha" /></td>
44
  <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>
46
</tr></table>