Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.02 KB | None | 0 0
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3. require APPPATH . '/libraries/REST_Controller.php';
  4. class Register extends REST_Controller
  5. {
  6.     function __construct($config = 'rest') {
  7.       parent::__construct($config);
  8.       $this->load->database();
  9.       $this->load->model('UserModel');
  10.       $this->load->library('email');
  11.     }
  12.     public function api_post()
  13.     {
  14.         $passwordHash = password_hash($this->post('password'), PASSWORD_DEFAULT);
  15.         $name = $this->post('name');
  16.         $data = array(
  17.           'name'        => $this->post('name'),
  18.           'email'       => $this->post('email'),
  19.           'telephone'   => $this->post('telephone'),
  20.           'age'         => $this->post('age'),
  21.           'password'    => $passwordHash,
  22.           'type'        => $this->post('type')
  23.         );
  24.         $email = $this->post('email');
  25.         $response = $this->UserModel->Register($data,$email,$name);
  26.         $this->set_response($response, REST_Controller::HTTP_OK);
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement