diff options
Diffstat (limited to 'app/v1_php/api/user/index.php')
-rw-r--r-- | app/v1_php/api/user/index.php | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/app/v1_php/api/user/index.php b/app/v1_php/api/user/index.php index 495bd2a..3b27b03 100644 --- a/app/v1_php/api/user/index.php +++ b/app/v1_php/api/user/index.php @@ -12,14 +12,12 @@ $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')"; +$req="INSERT INTO User VALUES (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"; +if ( $res===true && mysql_affected_rows() === 1 ) { + header("OK : CREATED", true, 201); } else { - // header 400, "Erreur" - echo "header 400, Erreur\n"; + header("erreur", true, 400); } ?> |