Location: PHPKode > projects > EZphotopress > ezphotopress-1.0.0/include/validatorAJAX.php
<?php
session_start();

require_once "../config.php";
include '../securimage/securimage.php';
$connessione = mysql_connect($_CONFIG['host'], $_CONFIG['user'], $_CONFIG['pass']) or die(mysql_error());
$selezione_db = mysql_select_db($_CONFIG['dbname'], $connessione) or die(mysql_error());

// funzione per verificare l'esistenza dell'email
function isset_email($email){
	$email = trim($email);
	$query = "SELECT COUNT(*) AS num FROM costumers WHERE email='" .mysql_real_escape_string($email). "'";
	$result = mysql_query($query) or die(mysql_error());
	$row = mysql_fetch_array($result);
	if($row['num']>=1) {
		return TRUE; // true se utente esiste
	} else {
		return FALSE;
 	}
}


if (isset($_POST['captcha_code'])) {
	$securimage = new Securimage();
	if ($securimage->check($_POST['captcha_code']) == false) {
		echo 'false';
	} else {
		echo 'true';
	}
}

if (isset($_POST['email'])) {
	if(!isset_email($_POST['email'])) {
		echo 'true';
	} else {
		echo 'false';
	}
}

?>
Return current item: EZphotopress