Advertisement
Guest User

Untitled

a guest
May 19th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. public function adduser()
  2. {
  3. $this->template->content->adduserform = new View('admin_adduserform');
  4. $this->template->content->adduserform->companies = ORM::factory('company')->select('id','name')->where(array('name!=' => 'admin'))->find_all()->select_list('id','name');
  5.  
  6. if($_SERVER['REQUEST_METHOD'] == 'POST')
  7. {
  8. echo $this->input->post('company');
  9. $this->user = ORM::factory('user', $this->input->post('username'));
  10. $this->user->username = $this->input->post('username');
  11. $this->user->email = $this->input->post('email');
  12. $this->user->password = $this->input->post('password');
  13. $this->user->company_id = $this->input->post('company');
  14.  
  15. if ($this->user->username == 'admin')
  16. {
  17. $this->user->add(ORM::factory('role', array('name' => 'admin')));
  18. $this->user->add(ORM::factory('role', array('name' => 'login')));
  19. } else {
  20. $this->user->add(ORM::factory('role', array('name' => 'login')));
  21. }
  22.  
  23. $this->user->save();
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement