summaryrefslogtreecommitdiff
path: root/app/v1_php/api/login/index.php
blob: 6cd1d771c1a29ef3c099b0d66979deb66d55dbec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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é

?>