> For the complete documentation index, see [llms.txt](https://playground.e107sk.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://playground.e107sk.com/e107-efiction-integration-update/functionality/captcha.md).

# Captcha

## eFiction way:

```
if($captcha && !isMEMBER && !captcha_confirm()) $output .= write_error(_CAPTCHAFAIL);

if(!USERUID && !empty($captcha)) $output .= "<tr><td><span class='label'>"._CAPTCHANOTE."</span></td><td><img width=120 height=30 src='"._BASEDIR."includes/button.php' alt='CAPTCHA image'><br /><br /><input MAXLENGTH=5 SIZE=5 name='userdigit' type='text' value=''></td></tr>";

$output .= "<tr><td><label for='comments'>"._COMMENTS.":</label></td><td> <TEXTAREA  class='textbox' name='comments' cols='50' rows='6'></TEXTAREA></td></tr>";
```

* includes/button.php
* includes/plain.button.php&#x20;

## **e107** way:

### e\_header.php

```
$newcaptcha = efiction_settings::get_single_setting('captcha');  

if($newcaptcha && extension_loaded('gd'))
{
	define('USE_IMAGECODE', TRUE);
}
else
{
	define('USE_IMAGECODE', FALSE);
}
```

### **in report.php**

* handler : `$sec_image = e107::getSecureImg();`

captcha test

```
if (USE_IMAGECODE && isset($_POST['rand_num']) && (e107::getSecureImg()->invalidCode($_POST['rand_num'], $_POST['code_verify']))) {
```

form rendering

```
 if (!USERUID && USE_IMAGECODE) {
    		//one table field to be able to use recaptcha
    		$output .= "<tr><td><label for='code_verify'>".e107::getSecureImg()->renderLabel().'</label>';
    		$output .= e107::getSecureImg()->renderimage();
    		$output .= e107::getSecureImg()->renderInput().'</td></tr>';
 }
```

![e107 recaptcha rendered on former contact page](/files/-MiRT-1ZoDwtmdYjWNWJ)

### in **reviewform.php**

### **in user/contact.php**

### **in challenges.php**

### **in user/editbio.php**
