summaryrefslogtreecommitdiff
path: root/app/v1_php/api/user/index.php
blob: 495bd2a75cd12a288fd2526cd19a10958a42363f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?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 (NULL,'$firstname', '$lastname', '$mail', '$password')";
$res=mysql_query($req);

if ( mysql_num_rows() === 1 ) {
	//TODO header 201, "OK : CREATED"
	echo "header 201, OK : CREATED\n";
} else {
	// header 400, "Erreur"
	echo "header 400, Erreur\n";
}
?>