Welcome Guest, Not a member yet? Register   Sign In
Problem Session Database, Login time too short
#1

[eluser]chandrajatnika[/eluser]
This is my setup on config.php
Code:
$config['sess_cookie_name']        = 'ci_session';
$config['sess_expiration']        = 7200;
$config['sess_encrypt_cookie']    = FALSE;
$config['sess_use_database']    = TRUE;
$config['sess_table_name']        = 'login_sessions';
$config['sess_match_ip']        = TRUE;
$config['sess_match_useragent']    = TRUE;
$config['sess_time_to_update']     = 1800;
Why with this setup I randomly get a short time login?
I've ask this before in forum reply but nobody give an answer. Please help me..

Thank you, Best regards
#2

[eluser]MVUG[/eluser]
is this the problem?

http://www.php.net/manual/en/session.con...axlifetime
#3

[eluser]chandrajatnika[/eluser]
So it means CI cannot redeclare value of PHP.ini at that time?
#4

[eluser]jasonjack[/eluser]
Good to see it shared by you.
#5

[eluser]WanWizard[/eluser]
CodeIgniter doesn't use any PHP native session information.

If you loose sessions, it's either because you have a logic error in your code, or you have a concurrency issue.

CI's session library can't deal with concurrent requests, so if your application uses ajax calls, and/or allow multiple windows to be open, and/or uses file uploads that may take a while, you have to look for some fixes. I've posted a Session library replacement that solves most of these issues, use the search.

Another option is to be less secure, and disable session id rotation (controlled by the sess_time_to_update setting). Set this to something very high (like 2 years or so), and see I you still have this problem. If this solves it, my library can help you, as leaving it disabled it in a production environment is a security risk.
#6

[eluser]MVUG[/eluser]
[quote author="WanWizard" date="1294866902"]CodeIgniter doesn't use any PHP native session information.

If you loose sessions, it's either because you have a logic error in your code, or you have a concurrency issue.

CI's session library can't deal with concurrent requests, so if your application uses ajax calls, and/or allow multiple windows to be open, and/or uses file uploads that may take a while, you have to look for some fixes. I've posted a Session library replacement that solves most of these issues, use the search.

Another option is to be less secure, and disable session id rotation (controlled by the sess_time_to_update setting). Set this to something very high (like 2 years or so), and see I you still have this problem. If this solves it, my library can help you, as leaving it disabled it in a production environment is a security risk.[/quote]

where can I find your session library replacement?
#7

[eluser]vickel[/eluser]
@WanWizard: I've been strugling for a while with CI session problems (see my thread http://ellislab.com/forums/viewthread/177793/). Fisrt I thought I had an AJAX related problem but then I found out that once you have the configuration set to use the database ($config['sess_use_database'] = TRUEWink for some weird reason randomly the session data gets lost and you are kicked out of e.g. an intranet, or shopping cart. This is reported by other people, like in thread http://ellislab.com/forums/viewthread/114301/P0/ by Stu Green or chandrajatnika in this thread. When I set the CI session back to be used without the database, all is ok. ANy ideias? thanks
#8

[eluser]InsiteFX[/eluser]
I have posted this many times on here! If your using CI Database Sessions.

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

/**
* ------------------------------------------------------------------------
* CI Session Class Extension.
* ------------------------------------------------------------------------
*
* Add the following define to the bottom of application/config/constants.php
* // Define Ajax Request
* define('IS_AJAX', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
*
*/

class MY_Session extends CI_Session {

   /*
    * Do not update an existing session on ajax calls
    *
    * @access    public
    * @return    void
    */
    public function sess_update()
    {
        if ( ! IS_AJAX)
        {
            $this->sess_time_to_update = 300;
            parent::sess_update();
        }
        else
        {
            // change update = to your value, if to low.
            $this->sess_time_to_update = 1200;
            parenet::sess_update();
        }
    }

    function sess_destroy()
    {
        parent::sess_destroy();

        $this->userdata = array();
    }

}

// ------------------------------------------------------------------------
/* End of file MY_Session.php */
/* Location: ./application/libraries/MY_Session.php */

InsiteFX
#9

[eluser]vickel[/eluser]
@InsiteFX, I've tried that again and again, it doesn't make any difference. Only NOT using the database works without getting kicked out randomly
#10

[eluser]WanWizard[/eluser]
A quick visit to the search option would have found it for you: http://ellislab.com/forums/viewthread/13...15/#811009.




Theme © iAndrew 2016 - Forum software by © MyBB