summaryrefslogtreecommitdiff
path: root/app/v1_php/api/user
diff options
context:
space:
mode:
authorJulien Sere <jsere>2011-01-22 11:50:29 +0000
committerJulien Sere <jsere>2011-01-22 11:50:29 +0000
commit12f6cc3a6f90a67c1d922dd3d46a368b1066dee1 (patch)
treedce223a8bf2386ba0fa125414a6045df3ac198ca /app/v1_php/api/user
parent0180447ad17eb36e54dca74f9854657d7ec5fa9a (diff)
download2011-usi-12f6cc3a6f90a67c1d922dd3d46a368b1066dee1.tar.gz
2011-usi-12f6cc3a6f90a67c1d922dd3d46a368b1066dee1.tar.bz2
2011-usi-12f6cc3a6f90a67c1d922dd3d46a368b1066dee1.zip
Implémentation de user et game.
git-svn-id: file:///var/svn/2011-usi/trunk@8 db941bf7-0cb3-4dda-9634-87faf64f93a7
Diffstat (limited to 'app/v1_php/api/user')
-rw-r--r--app/v1_php/api/user/form.html2
-rw-r--r--app/v1_php/api/user/index.php10
2 files changed, 5 insertions, 7 deletions
diff --git a/app/v1_php/api/user/form.html b/app/v1_php/api/user/form.html
index a01d2dd..fb2fc67 100644
--- a/app/v1_php/api/user/form.html
+++ b/app/v1_php/api/user/form.html
@@ -3,7 +3,7 @@
</head>
<body>
-<form method="POST">
+<form method="POST" action="index.php">
<div class="form_line">
<label name="firstname">firstname</label>
<input type="text" name="firstname"></input>
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);
}
?>