File "validation_client.php"
Full Path: /home/analogde/www/filechange/WEBSITE/douche/validation_client.php
File size: 2.35 KB
MIME-type: text/x-php
Charset: utf-8
<?php
date_default_timezone_set('Europe/Paris');
//$_POST['name'] = "alpha";
//$_POST['email'] = "cretin";
//$_POST['email'] = "Patrice.Delpy@onsemi.com";
//$_POST['phone'] = "0102030405";
if( isset($_POST['email']) )
{
$email = $_POST['email'];
require_once __DIR__ . '/db_connect.php';
$db = new DB_CONNECT();
$query = "SELECT * FROM client ". " WHERE email = '$email'";
$results = mysql_query($query);
$num_rows = mysql_num_rows($results);
if ($num_rows == 0)
{
$response["success"] = "1";
$response["message"] = "UNKNOWN";
echo json_encode($response);
}
if ($num_rows == 1)
{
$response["success"] = "2";
$response["message"] = "OK";
echo json_encode($response);
}
}
else
{
$response["success"] = "0";
$response["message"] = "ERREUR";
echo json_encode($response);
}
/*
// existe dans la DB ?
$query = "SELECT * FROM table_users ". " WHERE name = '$name' AND email = '$email'";
$results = mysql_query($query);
$num_rows = mysql_num_rows($results);
// oui - message d'erreur
if ($num_rows > 0)
{
$response["success"] = 2;
$response["message"] = "Exists in DB ?.";
echo json_encode($response);
}
// non - on enregistre
else
{
$result = mysql_query( "INSERT INTO table_users(id, name, email, password) VALUES( '', '$name', '$email' , '' )" );
if ($result)
{
$response["success"] = 1;
$response["message"] = "user account successfully created.";
echo json_encode($response);
}
else
{
$response["success"] = 0;
$response["message"] = "Oops! An error occurred.";
echo json_encode($response);
}
}
*/
/*
CREATE TABLE table_users
(
id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
email varchar(50) NOT NULL,
phone varchar(30) NOT NULL,
jour varchar(30) NOT NULL,
heure varchar(30) NOT NULL
)
*/
/*
id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
client varchar(100) NOT NULL,
jeu varchar(100) NOT NULL,
date varchar(30) NOT NULL,
time varchar(30) NOT NULL,
ts varchar(30) NOT NULL
*/
?>