Advertisement
roynaldoindra

apiregister.php

Jul 18th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. <?php
  2.  
  3. defined('BASEPATH') OR exit('No direct script access allowed');
  4.  
  5. require APPPATH . '/libraries/REST_Controller.php';
  6. use Restserver\Libraries\REST_Controller;
  7.  
  8. class ApiRegister extends REST_Controller {
  9.  
  10. function __construct($config = 'rest') {
  11. parent::__construct($config);
  12. $this->load->database();
  13. }
  14.  
  15.  
  16. function index_post() {
  17. $data = array(
  18. 'id_cust' => $this->post('id_cust'),
  19. 'nama_cust' => $this->post('nama_cust'),
  20. 'username' => $this->post('username'),
  21. 'password' => $this->post('password'),
  22. 'email' => $this->post('email'),
  23. 'no_hp' => $this->post('no_hp'));
  24. $insert = $this->db->insert('customer', $data);
  25. if ($insert) {
  26. $this->response($data, 200);
  27. } else {
  28. $this->response(array('status' => 'fail', 502));
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement