summaryrefslogtreecommitdiff
path: root/app/v1_php/api/user/index.php
blob: 3b27b0302f7eba394f711a8504ed38b836116843 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?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);
}
?>