CodeIgniter Forums

Full Version: Lost session
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7

El Forum

[eluser]Moiz[/eluser]
well the issue here is only IE .... why does it happen only on IE.

Works perfectly fine with Mozilla, Opera ..etc. but when i use IE .. there are multiple entries in the database with diff session ID's and the values of the Session as different.

Also ... using IE : my IP address is shown as sumthing else and using Mozilla .. its sumthing else ! im sure its coz of the HTTP_x_FORWARDED value ... but why are multiple entries made in the database for each page i click

El Forum

[eluser]rom_lap_trinh[/eluser]
Please tell me session time to update
$config['sess_time_to_update'] = ?????

El Forum

[eluser]Moiz[/eluser]
Code:
$config['sess_cookie_name']= 'ma_session';
$config['sess_expiration']= 1200;
$config['sess_encrypt_cookie']= TRUE;
$config['sess_use_database']= TRUE;
$config['sess_table_name']= 'ci_session';
$config['sess_match_ip']= FALSE;
$config['sess_match_useragent']    = TRUE;
$config['sess_time_to_update']     = 600;

El Forum

[eluser]rom_lap_trinh[/eluser]
Would you mind to replace:

$config['sess_cookie_name']= 'masession';
$config['sess_expiration']= 7200;
$config['sess_encrypt_cookie']= TRUE;
$config['sess_use_database']= TRUE;
$config['sess_table_name']= 'ci_session';
$config['sess_match_ip']= FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 7200;

El Forum

[eluser]Moiz[/eluser]
Actually .. a 2 hour time out is out of the question. it posses a security risk on public computers. the max time of a session time out as per client requirement would be 30 mins. anyway, i have set these vals :

Code:
$config['sess_expiration'] = 3600; // one hour

im goin to test it online rather than a local development env, so if there are any issues ... i'll get back to this thread

El Forum

[eluser]letrangere[/eluser]
[quote author="vibeesh p" date="1240402474"]Please have a try

Check the encoding of your ci_sessions database table field

change it to utf8_general_ci[/quote]

I've already sorted this in another way.
But this tip feels like the solution.
My encoding was set to latin1_swedish_ci.
I'll let y'all know if I try this again.

Thanks!

El Forum

[eluser]Unknown[/eluser]
Hi.
Have tried with some of the suggested methods and... no luck.
Here is my temporal solution while this issue can be solved.

It is pretty obvious but hope it helps:

Code:
<?php
if (! defined( 'BASEPATH' ))
    exit( 'No direct script access allowed' );

require_once 'system/libraries/Session.php';

/**
* Solución temporal al issue de pérdida de sesión
*/
class MY_Session extends CI_Session {
    
    function MY_Session() {
        parent::CI_Session();
    }
    
    function set_userdata($name, $value) {
        $_SESSION ['my_session'] [$name] = serialize( $value );
    }
    
    function userdata($name) {
        
        if (! isset( $_SESSION ['my_session'] [$name] )) {
            return false;
        } else {
            return unserialize( $_SESSION ['my_session'] [$name] );
        }
    
    }
    
    function unset_userdata($name) {
        unset( $_SESSION ['my_session'] [$name] );
    }

}

El Forum

[eluser]jamesf[/eluser]
I was having the same issue and I believe it was caused by certain UTF-8 characters in the session. As a quick fix I used the base64_encode/base64_decode functions in the _serialize/_unserialize methods like this:

Code:
function _serialize($data)
{
    if (is_array($data))
    {
        foreach ($data as $key => $val)
        {
            $data[$key] = str_replace('\\', '{{slash}}', $val);
        }
    }
    else
    {
        $data = str_replace('\\', '{{slash}}', $data);
    }
    
return base64_encode(serialize($data));
}
Code:
function _unserialize($data)
{
    $data = @unserialize(base64_decode(strip_slashes($data)));

    if (is_array($data))
    {
        foreach ($data as $key => $val)
        {
            $data[$key] = str_replace('{{slash}}', '\\', $val);
        }

        return $data;
    }

    return str_replace('{{slash}}', '\\', $data);
}

Certainly not ideal but it got the job done.

Found this which explains the rationale:
PHP Serialize

El Forum

[eluser]darkbrian[/eluser]
Having the same issue - James_F's solution fixes it for me. I was getting it using the cart class, adding items that had ( or other characters in it.

El Forum

[eluser]Unknown[/eluser]
oh thanks Smile with your help i´ve fixed it.

greetings from france
Pages: 1 2 3 4 5 6 7