diff options
author | Simon Rettberg | 2016-04-29 20:55:59 +0200 |
---|---|---|
committer | Simon Rettberg | 2016-04-29 20:55:59 +0200 |
commit | cbd23b7d191327a7cfb6a98e657659045da71af3 (patch) | |
tree | f029ab85c3ac07d3f2a56b4359fd36c265898d6d /apis/webservice/login.php | |
parent | More Progress; Merged changes from ufpr up to 775cdbd29f5d0f70946d1d5ff09c091... (diff) | |
download | slx-admin-cbd23b7d191327a7cfb6a98e657659045da71af3.tar.gz slx-admin-cbd23b7d191327a7cfb6a98e657659045da71af3.tar.xz slx-admin-cbd23b7d191327a7cfb6a98e657659045da71af3.zip |
Second half of merge....
Diffstat (limited to 'apis/webservice/login.php')
-rw-r--r-- | apis/webservice/login.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/apis/webservice/login.php b/apis/webservice/login.php new file mode 100644 index 00000000..e21975af --- /dev/null +++ b/apis/webservice/login.php @@ -0,0 +1,23 @@ +<?php +$login = $_POST['login']; +$sql = "select * from `user` WHERE login= :login"; +$user=Database::queryFirst($sql, array("login"=> $login)); +if($user){ + if(Crypto::verify($_POST['passwd'],$user['passwd'])){ + $_SESSION['userid']=$user['userid']; + echo json_encode(array( + "errormsg"=> "", + "status" => "ok", + "msg" => "Login successful")); + }else{ + echo json_encode(array( + "errormsg"=> "Wrong passwd", + "status" => "error", + "msg" => "")); + } +}else{ + echo json_encode(array( + "errormsg"=> "User not found", + "status" => "error", + "msg" => "")); +} |