这是我第一次使用加密库。我已阅读文档,并对字符串进行了一些加密。我想问一下这是一件有效的事情。
我的代码:
public function store_cookie($email){
if($this->input->post('remember_me') == 'remember'){
//try email later
$cookie = array(
'name' => 'remember' ,
'value' => $email,
'expire' => '86500',
'prefix' => '',
'secure' => FALSE
);
$this->input->set_cookie($this->encryption->encrypt($cookie));
}
}
答案 0 :(得分:1)
这不是存储加密Cookie的正确方法,加密值(如有必要)而非整个Cookie,请查看以下代码
public function store_cookie($email) {
if($this->input->post('remember_me') == 'remember'){
//try email later
$cookie = array(
'name' => 'remember' ,
'value' => $this->encryption->encrypt($email),
'expire' => '86500',
'prefix' => '',
'secure' => FALSE
);
$this->input->set_cookie($cookie);
}
}