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 Register extends REST_Controller
- {
- function __construct($config = 'rest') {
- parent::__construct($config);
- $this->load->database();
- $this->load->model('UserModel');
- $this->load->library('email');
- }
- public function api_post()
- {
- $passwordHash = password_hash($this->post('password'), PASSWORD_DEFAULT);
- $name = $this->post('name');
- $data = array(
- 'name' => $this->post('name'),
- 'email' => $this->post('email'),
- 'telephone' => $this->post('telephone'),
- 'age' => $this->post('age'),
- 'password' => $passwordHash,
- 'type' => $this->post('type')
- );
- $email = $this->post('email');
- $response = $this->UserModel->Register($data,$email,$name);
- $this->set_response($response, REST_Controller::HTTP_OK);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement