<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*------------------------------------------------------*/
if (isset($_SERVER['HTTP_ORIGIN'])) {
    header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
    header('Access-Control-Allow-Credentials: true');
    header('Access-Control-Max-Age: 86400');    // cache for 1 day
}
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
 
	if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))
        header("Access-Control-Allow-Methods: POST, POST, OPTIONS");         
 
    if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
        header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");
 
    exit(0);
}
/* -----------------------------------------------------*/

if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
 
	if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))
        header("Access-Control-Allow-Methods: GET, GET, OPTIONS");         
 
    if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
        header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}"); 
 
    exit(0);
} 
/* -----------------------------------------------------*/ 
require APPPATH . 'perutions/REST_Controller.php';
require APPPATH . 'perutions/Format.php';
use Restserver\Libraries\REST_Controller;
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE");
class Faq extends REST_Controller {
    
    public function __construct() {
        parent::__construct();
        $this->load->database();
        $this->load->library('phppass/passwordhash');
        
        // Load these helper to create JWT tokens
        $this->load->helper(['jwt', 'authorization']);    
        $this->load->library('email');
    }
    
    
	
	public function getfaqs_post()
	{
	    $qry="select * from ecom_faq";
	    $query=$this->db->query($qry);
	    $data=$query->result_array();
	    
	    $status = parent::HTTP_OK;
        $response = ['httpstatus' => $status, 'status' => 'Success', 'data' => $data];
        $this->response($response, $status);
	}
	
}