claviska - simple-php-captcha

Costas

Administrator
Staff member
http://github.com/claviska/simple-php-captcha
or
http://labs.abeautifulsite.net/simple-php-captcha/

so we have
JavaScript:
<?php
//contact.php
//if a session is not created 
if(!isset($_SESSION)) 
  session_start(); //create it

//ref the lib
include("captcha/simple-php-captcha.php");

//store to a session variable
$_SESSION['captcha'] = simple_php_captcha();
?>

<form id="contact_form" action="contact_send.php" method="POST">
  <img name="" src='<?=$_SESSION['captcha']['image_src'];?>']
  <input name="captcha_" class="form-control" style="float:right;width:100px" maxlength="10" id="captcha_" required> 
</form>
 
 
JavaScript:
//contact_send.php
<?php 
if(!isset($_SESSION)) 
	session_start();

if (!isset($_POST["contact_name"]) || !isset($_POST["contact_mail"]) || !isset($_POST["contact_message"]) ||  !isset($_POST["captcha_"]) || !isset($_SESSION['captcha']['code']))
	die("error 0x003");

//case insensitive comparison
if (strtolower($_POST["captcha_"]) != strtolower($_SESSION['captcha']['code']))
	die("error 0x004");


similar - http://www.phpcaptcha.org/
js only - https://www.pipiscrew.com/2015/08/js-10-very-useful-jquery-captcha-plugins/
 
Top