Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- defined('BASEPATH') OR exit('No direct script access allowed');
- require APPPATH . '/libraries/REST_Controller.php';
- class User extends REST_Controller {
- public function api_get(){
- $headers = $this->input->request_headers();
- if (array_key_exists('Authorization', $headers) && !empty($headers['Authorization'])) {
- $decodedToken = AUTHORIZATION::validateToken($headers['Authorization']);
- if ($decodedToken != false) {
- if($id_user = $this->uri->segment(3)){
- $response = $this->UserModel->getUserProfile($id_user);
- $this->set_response($response, REST_Controller::HTTP_OK);
- }
- }
- }else{
- $this->set_response("Unauthorised", REST_Controller::HTTP_UNAUTHORIZED);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement