From 12f6cc3a6f90a67c1d922dd3d46a368b1066dee1 Mon Sep 17 00:00:00 2001 From: Julien Sere Date: Sat, 22 Jan 2011 11:50:29 +0000 Subject: Implémentation de user et game. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///var/svn/2011-usi/trunk@8 db941bf7-0cb3-4dda-9634-87faf64f93a7 --- app/v1_php/api/user/index.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'app/v1_php/api/user/index.php') 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); } ?> -- cgit v1.2.3