如何防止浏览器在用户登录后返回登录表单页面....????
public function fileITR()
{
$this->load->helper('captcha');
$this->form_validation->set_rules('pancard','pancard','required');
$this->form_validation->set_rules('password','password','required|min_length[5]');
$this->form_validation->set_rules('captcha','captcha','required');
if($this->form_validation->run() == TRUE )
{
$pancard = $_POST['pancard'];
$password = md5($_POST['password']);
$this->db->select('*')
->from('users')
->where(array('pancard' =>$pancard,'pass'=>$password));
$query = $this->db->get();
$user = $query->row();
if($user)
{
$this->session->set_flashdata("success","you are logged in");
$_SESSION['user_logged'] = TRUE;
$_SESSION['pancard'] = $user->pancard;
$this->session->userdata('filename');
redirect("home/UserPage");
}
else
{
$this->session->set_flashdata("error","No such account exists in database");
redirect("Home/fileITR" , "refresh");
}
$this->load->view('fileITR');
}
$file = $this->session->userdata('filename');
if($file && file_exists('./captcha/'.$file))
{
unlink('./captcha/' .$this->session->userdata('filename'));
}
$args = array(
'img_path' => './captcha/',
'img_url' => base_url('captcha'),
'img_width' => 120,
'word_length' => 5,
'font_size' => 10,
'pool' =>'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'colors' => array(
'background' =>array(255,255,255),
'border' =>array(0,0,0),
'text' =>array(0,0,0),
'grid' =>array(0,0,0)
)
);
$cap = create_captcha($args);
$this->session->set_userdata('captcha_key',$cap['word']);
$this->session->set_userdata('filename',$cap['filename']);
$this->load->view('fileITR' , array('captcha' => $cap));
}
> 不要使用 MD5 作为密码
>>不要使用 MD5 作为密码
>>>不要使用 MD5 作为密码
http://php.net/manual/en/function.password-hash.php
https://security.stackexchange.com/questions/19906/is-md5-considered-insecure
关于您的问题:您无法阻止用户返回登录。但是,一旦用户进入登录页面,您就可以检查他/她是否已登录,然后重定向到仪表板。