1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
<?php namespace controller; use \Firebase\JWT\JWT;
class Auth { public function login() { $ret = array(); $token = array( "userName" => "generic_user", "id" => 1, );
$jwt = JWT::encode($token, $GLOBALS['private_key']);
$ret = array('status'=>1, 'token'=>$jwt); return json_encode($ret); }
public function logout() { $body = file_get_contents('php://input'); $requstOb = json_decode($body,true); $db = \MysqliDb::getInstance(); $data = Array ('NameRO' => $requstOb['name']); $db->where ('id', $requstOb['id']); $db->update ('gallerydir', $data);
$item = array('id' => $requstOb['id'], 'name'=>$requstOb['name']); return json_encode(array('status'=> 1, 'message'=>'logout', 'items'=> $item)); } } ?>
|