C:\xampp\htdocs\kptv2\admin2\services\controller\Auth.php


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
35
36
37
<?php
namespace controller;
use \
Firebase\JWT\JWT;

class 
Auth {
    public function 
login(){
    
        
$body file_get_contents('php://input');
        
$requstOb json_decode($body,true);     
        
$ret = array();
        if(
$requstOb['username'] === "kptvadmin" && $requstOb['password'] === "_kptv1470#") {
            
$token = array("userName" => "admin","id" => 1);
            
$jwt JWT::encode($token$GLOBALS['private_key']);
            
$ret = array('status'=>1'token'=>$jwt);
            return 
json_encode($ret);
        }
        
        
http_response_code(401);
    }

    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'=>'Photo category updated.', 'items'=> $item));        
        */
    
}    
}
?>
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586