Postingan lainnya
Password form registrasi codeigniter
bagaiamana caranya supaya form registrasi pada kolom password bisa menjadi sha1?
public function registration()
{
// Section1 //
$this->form_validation->set_rules('nama_lengkap1', 'Nama_Lengkap', 'required|trim');
$this->form_validation->set_rules('email', 'Email', 'required|trim|valid_email|is_unique[user.email]', [
'is_unique' => 'This email has alrady registered!'
]);
$this->form_validation->set_rules(
'password1',
'Password',
'required|trim|min_length[5] |matches[password2]',
['matches' => 'password dont match!', 'min_length' => 'Password too short!']
);
$this->form_validation->set_rules('password2', 'Password', 'required|trim|matches[password1]');
];
$this->db->insert('user', $data);
$this->session->set_flashdata('message', '<div class="alert alert-success" role="alert">
Selamat! Akun anda telah terdaftar. Silahkan masuk! </div>');
redirect('auth/login');
}
}
if ($this->form_validation->run() == false) {
$this->load->view('templates/auth_header');
$this->load->view('auth/registration');
$this->load->view('templates/auth_footer');
} else {
$data = [
'nama_lengkap' => htmlspecialchars($this->input->post('nama_lengkap1', true)),
'email' => htmlspecialchars($this->input->post('email', true)),
'password' => password_hash($this->input->post('password1'), PASSWORD_DEFAULT),
'photo' => 'default.jpg',
'role_id' => 2,
'is_acvtive' => 1,
'date_created' => time()
];
$this->db->insert('user', $data);
$this->session->set_flashdata('message', '<div class="alert alert-success" role="alert">
Selamat! Akun anda telah terdaftar. Silahkan masuk! </div>');
redirect('auth/login');
}
}
0
1 Jawaban:
<pre>sha1($this->input->post('password1'));</pre><div><br></div>
0