<?php

/*
Table User : id, firstname, lastname, mail, password
Unique key : mail
*/

require_once("../mysql_connect.inc.php");

$firstname=mysql_real_escape_string($_POST['firstname']);
$lastname=mysql_real_escape_string($_POST['lastname']);
$mail=mysql_real_escape_string($_POST['mail']);
$password=mysql_real_escape_string($_POST['password']);

$req="INSERT INTO User VALUES (NULL, '$firstname', '$lastname', '$mail', '$password')";
$res=mysql_query($req);

if ( $res===true && mysql_affected_rows() === 1 ) {
	header("OK : CREATED", true, 201);
} else {
	header("erreur", true, 400);
}
?>