<?php
 
 
/**
 
*             AJAX CAPTCHA
 
*
 
* @author      Zehair ALAOUI SOSSE <[email protected]>
 
* @website     http://blog.deepscripts.com/
 
* @license     GPL v3
 
 */
 
 
 
if (!isset($_SESSION)) 
 
    session_start(); 
 
 
require "captcha.class.php";
 
 
error_reporting(E_ALL ^ E_NOTICE);
 
 
try{    
 
    $reponse = array();    
 
        
 
    switch($_GET['action'])
 
    {
 
        case 'captcha':            
 
            $reponse = Captcha::Build();            
 
        break;    
 
        
 
        
 
        case 'check':
 
            $reponse = Captcha::Check($_POST['dscaptchavalue']);
 
        break;
 
        
 
        default:
 
            throw new Exception('Il y a une erreurs');
 
    }
 
    
 
    echo json_encode($reponse);
 
}
 
catch(Exception $e)
 
{
 
    die(json_encode(array('status'=>0, 'erreur' => $e->getMessage())));
 
}
 
 
?>
 
 |