function index()
{
………
else
{
……
$cap = create_captcha($cdata);
[color=red]$this->session->set_userdata('captcha',$cap['word']);//这样可以解决session 与 验证码不同步 ,而$this->session->set_flashdata('captcha',$cap['word']) 就会出现不同步的现象 请高手指点一下什么区别???
$this->load->view('sys_login',$cap);
}
}
……
function _do_post()
{
$username = $this->input->post('username',true);
$password = $this->input->post('password',true);
[color=red] $capvcode = $this->input->post('capcode',true);
if($capvcode == $this->session->userdata('captcha'))
{
if($username && $password && $capvcode)
{
$admin = $this->user_mdl->get_full_user_by_username( $username );
……
}
}
else
{
$this->session->set_flashdata('error', '请输入正确的验证码!');
redirect(setting('backend_access_point').'/login');
}