SHARE
TWEET

Untitled

a guest Jun 26th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3. require APPPATH . '/libraries/REST_Controller.php';
  4. class User extends REST_Controller {
  5.     public function api_get(){
  6.         $headers = $this->input->request_headers();
  7.         if (array_key_exists('Authorization', $headers) && !empty($headers['Authorization'])) {
  8.             $decodedToken = AUTHORIZATION::validateToken($headers['Authorization']);
  9.             if ($decodedToken != false) {
  10.                 if($id_user = $this->uri->segment(3)){
  11.                   $response = $this->UserModel->getUserProfile($id_user);
  12.                   $this->set_response($response, REST_Controller::HTTP_OK);
  13.                 }
  14.             }
  15.         }else{
  16.           $this->set_response("Unauthorised", REST_Controller::HTTP_UNAUTHORIZED);
  17.         }
  18.     }
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top