Php codeigniter找不到md5密码
我用的是杰米·鲁姆博罗的最新版本 下面是我创建用户的方法 controllers/users.php 我创建了创建会话登录的方法: controllers/sessions.phpPhp codeigniter找不到md5密码,php,session,codeigniter-2,Php,Session,Codeigniter 2,我用的是杰米·鲁姆博罗的最新版本 下面是我创建用户的方法 controllers/users.php 我创建了创建会话登录的方法: controllers/sessions.php 但是我无法检索任何用户,请帮助,我遗漏了什么?谢谢我打赌框架存储的密码(如果基于md5)是咸的。使用md5作为密码有点风险。即使是咸的。尝试sha256/sha512或BCryptI已将md5更改为散列'sha1',$this->input->post'password',但仍然得到相同的错误,现在它可以工作了:谢谢
但是我无法检索任何用户,请帮助,我遗漏了什么?谢谢我打赌框架存储的密码(如果基于md5)是咸的。使用md5作为密码有点风险。即使是咸的。尝试sha256/sha512或BCryptI已将md5更改为散列'sha1',$this->input->post'password',但仍然得到相同的错误,现在它可以工作了:谢谢大家,是'sha1'比md5更节省吗?我尝试了sha256和sha512,但我的phpmyadmin无法识别它们,也许我应该更新我的phpmyadmin版本
// add function
public function add()
{
$this->form_validation->set_rules($this->user->validate);
if ($this->form_validation->run() == TRUE)
{
$this->user->insert($this->user_params(), TRUE);
$this->session->set_flashdata('message', alert_info('Data berhasil disimpan'));
redirect('users');
}
$this->data['yield'] = $this->yield;
$this->load->view($this->layout, $this->data);
}
// user param
private function user_params()
{
return array(
'fullname' => $this->input->post('fullname') ,
'username' => $this->input->post('username') ,
'email' => $this->input->post('email') ,
'password' => md5($this->input->post('password')),
'gender' => $this->input->post('gender'),
);
}
//add function
public function add()
{
$this->form_validation->set_rules($this->user->rules);
if ($this->form_validation->run() == TRUE)
{
$user = $this->user->get_by($this->session_params());
if ($user)
{
$this->session->set_userdata('user_session', array(
'user_id' => $user->id,
'logged_in' => TRUE,
));
$this->session->set_flashdata('message', alert_success('Login Berhasil !'));
redirect('posts');
}
$this->session->set_flashdata('message', alert_danger('Invalid credentials, please try again'));
redirect('sessions/add');
}
$this->data['yield'] = $this->yield;
$this->load->view($this->layout, $this->data);
}
// session param
private function session_params()
{
// all the post values so I didn't repeat any form insertion
return array(
'username' => $this->input->post('username') ,
'password' => md5($this->input->post('password')),
);
}