Login   Register  
PHP Classes
elePHPant
Icontem

File: php/ajax.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Zehair  >  Captcha to download  >  php/ajax.php  >  Download  
File: php/ajax.php
Role: Example script
Content type: text/plain
Description: This is the script file
Class: Captcha to download
Show and check CAPTCHA images to protect downloads
Author: By
Last change:
Date: 1 year ago
Size: 725 bytes
 

Contents

Class file image Download
<?php

/**
*             AJAX CAPTCHA
*
* @author      Zehair ALAOUI SOSSE <deepscripts@gmail.com>
* @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())));
}

?>