samjhana joshi
samjhana joshi

Reputation: 2015

how to solve redirect url problems in Internet Explorer

My website project is running well in firefox and google chrome but has url problem in IE(IE10). When i do login from IE though username and password is correct, the url remains in login and not to dashboard as expected.Below in controller code for redirect url.

$user_name = $this->input->post('user_name');
$password = $this->input->post('pass_word');
$user_id = $this->login_model->check_login($user_name, md5($password));

if ($user_id != 0){
    //set session and redirect to dashboard
    $this->session->set_userdata('admin_id', $user_id);
    $next_url = $this->session->userdata('next_url');
    $this->session->unset_userdata('next_url');
    //redirect($next_url);
    redirect('administrator/dashboard' , 'location');
}else{ 
    $data['login'] = 'Invalid Username/Password!';
    $data['class'] = 'error';
    $this->session->set_flashdata($data);
    redirect('administrator/login');
}

Am i doing anything wrong. How am i to solve this? Any help or suggestions is welcome. Thanks in advance.

Upvotes: 4

Views: 4425

Answers (3)

samjhana joshi
samjhana joshi

Reputation: 2015

Found the solution to the problem.Server time wasn't same as client time. (server time:11:30am, client time:5:30pm) "Make sure your server’s time is correct. All browsers set cookies based on the client’s time. IE on the other hand, goes by server time. If the server’s time is in the past, cookies will expire as soon as they are set thus giving the illusion that your cookie never arrived." check the link: http://ellislab.com/forums/viewthread/135722/

Upvotes: 4

Pattle
Pattle

Reputation: 6016

Try changing

redirect('administrator/dashboard' , 'location');

to

redirect('administrator/dashboard' , 'refresh');

Just using location can sometimes cause problems

Upvotes: 1

Massimiliano Marini
Massimiliano Marini

Reputation: 499

Try to replace location with refresh

redirect('administrator/dashboard' , 'refresh');

Upvotes: 1

Related Questions