summaryrefslogtreecommitdiff
path: root/app/v1_php/api/login
diff options
context:
space:
mode:
authorJulien Sere <jsere>2011-01-22 13:53:33 +0000
committerJulien Sere <jsere>2011-01-22 13:53:33 +0000
commit738943804f2e4005e1948ed19e0d02e4cd1df431 (patch)
tree19a9b074ebe4dfd32e4f9a5d81b45c70845b016f /app/v1_php/api/login
parent12f6cc3a6f90a67c1d922dd3d46a368b1066dee1 (diff)
download2011-usi-738943804f2e4005e1948ed19e0d02e4cd1df431.tar.gz
2011-usi-738943804f2e4005e1948ed19e0d02e4cd1df431.tar.bz2
2011-usi-738943804f2e4005e1948ed19e0d02e4cd1df431.zip
On est bloqué à cause du long-polling... Pas de syncrho en php sous Windows
git-svn-id: file:///var/svn/2011-usi/trunk@9 db941bf7-0cb3-4dda-9634-87faf64f93a7
Diffstat (limited to 'app/v1_php/api/login')
-rw-r--r--app/v1_php/api/login/form.html20
-rw-r--r--app/v1_php/api/login/index.php23
2 files changed, 43 insertions, 0 deletions
diff --git a/app/v1_php/api/login/form.html b/app/v1_php/api/login/form.html
new file mode 100644
index 0000000..d514e10
--- /dev/null
+++ b/app/v1_php/api/login/form.html
@@ -0,0 +1,20 @@
+<html>
+<head>
+</head>
+
+<body>
+<form method="POST" action="index.php">
+ <div class="form_line">
+ <label name="mail">mail</label>
+ <input type="text" name="mail"></input>
+ </div>
+ <div class="form_line">
+ <label name="password">password</label>
+ <input type="text" name="password"></input>
+ </div>
+ <div class="form_line">
+ <input type="submit" />
+ </div>
+</form>
+</body>
+</html>
diff --git a/app/v1_php/api/login/index.php b/app/v1_php/api/login/index.php
new file mode 100644
index 0000000..6cd1d77
--- /dev/null
+++ b/app/v1_php/api/login/index.php
@@ -0,0 +1,23 @@
+<?php
+
+/*
+Table User
+*/
+
+require_once("../mysql_connect.inc.php");
+
+$mail=mysql_real_escape_string($_POST['mail']);
+$password=mysql_real_escape_string($_POST['password']);
+
+$req="SELECT 1 FROM User WHERE mail='$mail' AND password='$password' LIMIT 1";
+$res=mysql_query($req);
+
+if ( mysql_num_rows($res) !== 1 ) {
+ header("erreur", true, 400);
+ exit();
+}
+
+header("OK : CREATED", true, 201);
+setcookie("session_key", rand(0, 1024*1024*1024*2-1)); //TODO unicité
+
+?>