Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Client_test extends CI_Controller {
- function index()
- {
- $client_id = $this->input->post('client_id');
- $api_key = $this->input->post('api_key');
- if($this->auth($client_id,$api_key))
- {
- $return = array(
- 'code' => 200,
- 'mesage' => 'Authentifikasi berhasil',
- 'data' => array(
- 'nama' => 'Sutisna',
- 'alamat'=> 'Kartini'
- )
- );
- }
- else
- {
- $return = array(
- 'code' => 500,
- 'mesage' => 'Authentifikasi gagal',
- 'data' => array()
- );
- }
- echo json_encode($return);
- }
- function auth($username_input,$password_input)
- {
- $username="mobileapps";
- $password="12345";
- if(($username_input==$username) && ($password_input==$password))
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement