• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Session does not work in Opera and IE

#1
[eluser]Unknown[/eluser]
Hi. Session dont work in Opera & IE browser's. Session work fine in FF and Chrome. what is the problem ?
P.S.
on denwer it's work on all browser!

for example : in IE and Opera result always 'no' after i go on /index.php/welcome/creat/ . http://autotrading.lviv.ua/temp/index.ph...ome/creat/
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Welcome extends CI_Controller {
var $login ;
public function __construct() {
  parent::__construct();
  $this->load->library('session');
  $this->load->helper('url');
  $this->login = $this->session->userdata('login');
}

public function index()
{
  if($this->login) {
   echo 'ok';
  }
  else {
   echo 'no';
  }  
}
public function creat() {
  $this->session->set_userdata('login','yes');
  redirect('/welcome');
}
public function destroy() {
  $this->session->sess_destroy();
  redirect('/welcome');
}
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */

My config.php:
Code:
$config['sess_cookie_name']  = 'ci_session';
$config['sess_expiration']  = 7200;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = FALSE;
$config['sess_table_name']  = 'ci_sessions';
$config['sess_match_ip']  = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;

$config['cookie_prefix'] = "";
$config['cookie_domain'] = "";
$config['cookie_path']  = "/";
$config['cookie_secure'] = FALSE;

help me ! sorry for bad english.

#2
[eluser]InsiteFX[/eluser]
Try changing these:
Code:
$config['sess_cookie_name']  = 'cisession';
$config['sess_match_useragent'] = FALSE;

// this controllers when it will expire 300 = 5 minutes
$config['sess_time_to_update'] = 300;

#3
[eluser]Unknown[/eluser]
i have change only
Code:
$config['sess_expiration'] = 0; //
and session begin work . but why? in past there was no such problem. a few days ago in all my site's on codeigniter stop working session's in opera and IE.

#4
[eluser]InsiteFX[/eluser]
Because when you assign it 0 CodeIgniter makes it expire in 2 hours.

#5
[eluser]Refringe[/eluser]
You should be sure to fill out your cookie domain:
Code:
$config['cookie_domain'] = ".lviv.ua";
Leaving it empty can cause issues.

If you only want your sessions to last until the browser is closed then change sess_expiration back to the default (7200) and sess_expire_on_close to TRUE. Like this:

Code:
$config['sess_expiration']  = 7200;
$config['sess_expire_on_close'] = TRUE;

#6
[eluser]psharp[/eluser]
[quote author="Anjey" date="1330518986"]i have change only
Code:
$config['sess_expiration'] = 0; //
and session begin work . but why? in past there was no such problem. a few days ago in all my site's on codeigniter stop working session's in opera and IE.[/quote]

Interestingly, my CI project suffers from the same problems. On Feb. 29, it stopped working in IE and Opera but continued to work with Firefox and Chrome. Setting the $config['sess_expiration'] to 0 has allowed the site to continue to work but does not explain WHY it suddenly started to fail. I can find no significance in the date of Feb. 29, except for that is the day when I checked the sites with all browsers.

I've even started a new project from a CI base and installed only the tank_auth (www.konyukhov.com/soft/tank_auth/) libraries. This shows the same behavior where it will work on FF and Chrome, but fails on IE and Opera. I have not tried Safari yet.

These are the config file settings for sessions:
Code:
$config['sess_cookie_name']  = 'ci_session';
$config['sess_expiration']  = 0;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name']  = 'ci_sessions';
$config['sess_match_ip']  = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;

Since this was a working installation for months previous and there was no active development with it, the date of Feb. 29th may indeed have something to do with it. Randomly changing the session configuration settings to "here, try this" values does not seem to be a very solid way of determining what is wrong here.

Does anybody else have this problem? Are there any other explanations as to why a working site "stopped", just because of a date change?

#7
[eluser]CroNiX[/eluser]
Feb 29th was leap day. Don't know if that has anything to do with it, but it could if the browsers didn't account for it and issued cookies with the wrong date.

Edit: I'd check the date on the server, too.

#8
[eluser]psharp[/eluser]
[quote author="CroNiX" date="1331234078"]Feb 29th was leap day. Don't know if that has anything to do with it, but it could if the browsers didn't account for it and issued cookies with the wrong date.

Edit: I'd check the date on the server, too.[/quote]

An interesting thought. One thing I did forget to mention, is that I deleted all of the session records from the database. This was done in case some artifact of the date issue, remained. Unfortunately, this did not fix the problem. The date on the server seems to be intact.

I really want to blame the leap day thing, as the solution I used to get my site back up and running is not desirable. I'll keep hashing it out as I really want the sessions to have a limited life for IE and Opera browsers.



Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.