Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function edit( $id )
- {
- $where = array( 'id' => $id );
- $data['user'] = $this->Admin_model->get_single( 'users' , $where );
- $password = $data['user']->password;
- if (!empty($_POST)) {
- if ($this->form_validation->run('admin_users_create') == true)
- {
- if (empty($_POST['password']))
- {
- $_POST['password']=$password;
- }
- $data = array(
- 'name '=> $this->input->post('name', true),
- 'email' => $this->input->post('email', true),
- 'password' => password_hash($this->input->post('password', true), PASSWORD_BCRYPT),
- );
- $this->session->set_flashdata('alert','Użytkownik dodany poprawnie');
- refresh();
- }
- else{
- $this->session->set_flashdata('alert',validation_errors());
- refresh();
- }
- }
- $this->load->view('admin/users/edit');
- }
- public function unique_email_edit($email)
- {
- $id = $this->uri->segment(4);
- $where = array( 'id' => $id );
- $user = $this->Admin_model->get_single( 'users' , $where );
- if($user->email != $email && $user->id == $id)
- {
- return true;
- }
- else {
- $this->form_validation->set_message('username_check', 'Inny użytkownik ma taki email');
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement