82 lines
3.2 KiB
PHP
82 lines
3.2 KiB
PHP
<?php
|
|
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
// This can be removed if you use __autoload() in config.php OR use Modular Extensions
|
|
/** @noinspection PhpIncludeInspection */
|
|
require_once APPPATH . '/libraries/REST_Controller.php';
|
|
|
|
/**
|
|
* This is an example of a few basic user interaction methods you could use
|
|
* all done with a hardcoded array
|
|
*
|
|
* @package CodeIgniter
|
|
* @subpackage Rest Server
|
|
* @category Controller
|
|
* @author
|
|
* @license MIT
|
|
* @link
|
|
*/
|
|
class Masters_Controller extends REST_Controller {
|
|
function __construct()
|
|
{
|
|
// Construct the parent class
|
|
parent::__construct();
|
|
|
|
// Configure limits on our controller methods
|
|
// Ensure you have created the 'limits' table and enabled 'limits' within application/config/rest.php
|
|
$this->methods['add_fees_post']['limit'] = 100; // 100 requests per hour per user/key
|
|
//$this->load->model('Login_model', 'login_model');
|
|
}
|
|
|
|
//This method used to get Login
|
|
|
|
public function add_fees_post()
|
|
{
|
|
echo 'hai';
|
|
// $data = json_decode(file_get_contents('php://input'), true);
|
|
// //echo "function in";
|
|
|
|
// $feesdes = $data['Feesdes'];
|
|
// $active = $data['active'];
|
|
// $feesName = $data['feesName'];
|
|
// $feesdetails= array('FeesDescription'=>$feesdes,'FeesName'=>$feesName,'IsActive'=>$active);
|
|
// $res = $this->master_model->addfees($feesdetails);
|
|
// echo $feesdes.'----'.$active.'----'.$feesName;
|
|
//echo $userMobile;die;
|
|
// //echo $userMobile;die;
|
|
// $password = $this->post('password');
|
|
|
|
// $loginDetails = $this->login_model->login( $userMobile, $password);// Check if the users data store contains users (in case the database result returns NULL)
|
|
// //print_r($loginDetails);die;
|
|
// if ($loginDetails['loginStatus'])
|
|
// {
|
|
// // generate token
|
|
// $tokenData = array();
|
|
// $tokenData['ID'] = $loginDetails['details']->ID;
|
|
// $tokenData['UserType'] = $loginDetails['details']->ListCode;
|
|
// $tokenData['MobileNumber'] = $loginDetails['details']->MobileNumber;
|
|
// $tokenData['BranchCode'] = $loginDetails['details']->BranchCode;
|
|
// $tokenData['Admin'] = $loginDetails['details']->BranchCode;
|
|
// $tokenData['iat'] = strtotime("now");
|
|
// $tokenData['exp'] = strtotime("+2 minutes");
|
|
// //$tokenData['timestamp'] = strtotime("+2 hours");
|
|
// $output['token'] = AUTHORIZATION::generateToken($tokenData);
|
|
// // $generate=AUTHORIZATION::validateTimestamp($output['token']);
|
|
// // end generate token
|
|
// $output['loginStatus'] = true;
|
|
// // Set the response and exit
|
|
// $this->response($output);
|
|
// }
|
|
// else
|
|
// {
|
|
// // Set the response and exit
|
|
// $this->response([
|
|
// 'message' => 'No users were found',
|
|
// 'loginStatus' => false
|
|
// ]);
|
|
// }
|
|
}
|
|
|
|
}
|
|
|