summaryrefslogtreecommitdiff
path: root/app/v1_php/api/login/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/v1_php/api/login/index.php')
-rw-r--r--app/v1_php/api/login/index.php23
1 files changed, 23 insertions, 0 deletions
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é
+
+?>