Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function adduser()
- {
- $this->template->content->adduserform = new View('admin_adduserform');
- $this->template->content->adduserform->companies = ORM::factory('company')->select('id','name')->where(array('name!=' => 'admin'))->find_all()->select_list('id','name');
- if($_SERVER['REQUEST_METHOD'] == 'POST')
- {
- echo $this->input->post('company');
- $this->user = ORM::factory('user', $this->input->post('username'));
- $this->user->username = $this->input->post('username');
- $this->user->email = $this->input->post('email');
- $this->user->password = $this->input->post('password');
- $this->user->company_id = $this->input->post('company');
- if ($this->user->username == 'admin')
- {
- $this->user->add(ORM::factory('role', array('name' => 'admin')));
- $this->user->add(ORM::factory('role', array('name' => 'login')));
- } else {
- $this->user->add(ORM::factory('role', array('name' => 'login')));
- }
- $this->user->save();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement