Welcome Guest, Not a member yet? Register   Sign In
Code Igniter Session problem
#1

[eluser]Unknown[/eluser]
Hello

i've tried to use code igniter session library and used ci_session table for added security. so far it was working perfectly in my local machine both IE and firefox. but as soon i have uploaded that in to my client server (php 5) ; i saw that the site is running in Mozilla firefox perfectly but
if i run the site in Internet Explorer(IE), then the site couldnt save the session data.

what is the problem any suggessions?
#2

[eluser]danoph[/eluser]
welcome to the site, hassan. I am not sure about your question. It would probably get more of a response in the 'Code and Application Development' topic.
#3

[eluser]Derek Allard[/eluser]
I've moved it over. Hassan. Is IE set to accept cookies?
#4

[eluser]Unknown[/eluser]
yes! IE is set to accept cookies. and i told earlier that the system is running fine in IE in my local machine but the problem occurs on the client server.

let me show you the code..

i have a model name Login
Code:
class Login extends Model
{
   var $isAuth = false;

   function Login()
   {
      parent::Model();
   }

   function authenticate()
   {
      ...........;
      ...........;
      if($isAuth){
         $userdata = array(
           'userid'=> $recordSet->userid;
           'role'=> $recordSet->role;          
         );
         $this->session->set_userdata($userdata);
         ..............;
         ..............;
      }
   }
}

From a controller class i am trying to pull some data

Code:
class Members extends Controller
{
   function Members()
   {
       parent::Controller();
   }

   function showMemberData()
   {
       $this->db->where("userid", $this->session->userdata("userid"));//this line fails as it couldnt retrieve the userid in IE in my client server.
       $query = $this->db->get("users");
       .......;
       .......;
   }
}

Any idea about this?
#5

[eluser]Derek Allard[/eluser]
In the code you've posted, I don't see anything, but its hard to see what else might be going on. My next advice would be to try a reduction test - the minimum code needed to recreate the problem. I'd suggest a single controller with a "setsession" and a "readsession" function.
#6

[eluser]DiRN[/eluser]
I am experiencing a similar problem. My sessions are working correctly in Firefox but not in Internet Explorer. I set up a dummy controller (session is set in autoload.php) with the following results:

Test 1
Code:
<?php
  class Test extends Controller {
    function __construct () {
      parent::__construct ();
    }
    
    function index () {
      $this->session->set_userdata (array ('test' => "test"));
      var_dump ($this->session->userdata ("test"));
    }
  }
?>

Firefox: string(4) "test"
Internet Explorer: string(4) "test"

Test 2
Code:
<?php
  class Test extends Controller {
    function __construct () {
      parent::__construct ();
    }
    
    function index () {
      $this->session->set_userdata (array ('test' => "test"));
      $this->output->set_header ("location: /test/test2/");
    }
    
    function test2 () {
      var_dump ($this->session->userdata ("test"));
    }
  }
?>

Firefox: string(4) "test"
Internet Explorer: bool(false)

Has anyone figured this out yet?

**Edit** I've also tried using redirect ("test/test2"); and redirect ("test/test2", "refresh");
#7

[eluser]theswede[/eluser]
I'm also experiencing problems with sessions in IE. In IE/Safari I get new session id's with every reload, in Firefox the session is preserved between pageloads. (url: http://www.chattis.se/index.php/applications)

The webhotel my page is at has changed server configuration recently, probably moved us to another physical machine or so. On the old server, I did not have this problem, the session was preserved in IE as well as FF. I couldn't tell you what changed in the servers' configuration but I do know that no PHP code was changed in the project.

Edit:
PROBLEM SOLVED ... also learned a few things about sessions Smile

The server's internal clock was lagging behind a few hours. Solved w/ ntpdate as seen in another thread.
#8

[eluser]Derek Allard[/eluser]
Great stuff!

Could I trouble you to document in a bit more detail what was involved? Thanks!
#9

[eluser]DiRN[/eluser]
Wow! I never thought to check the time on my server. That seems to have fixed it for me too:
Code:
ntpdate tick.usno.navy.mil
#10

[eluser]Justin Patel[/eluser]
I had the same problem


I guess you might have change the root index.php to

Code:
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING );


make it to


Code:
error_reporting(E_ALL );


when I did this. then it was working perfectly.


Let me know is your problem got solved???




Theme © iAndrew 2016 - Forum software by © MyBB