Welcome Guest, Not a member yet? Register   Sign In
session time out....
#1

[eluser]gulan[/eluser]
Hi all,

How can I set a session time out in codeigniter.
Means I want to expire my application if the user is idle for a specific time say 5 minits..
please help me...


thanks
btb
#2

[eluser]gulan[/eluser]
Here we are using following code for session expiring. here is expiration is set to 0 in config file we are making it as 2 years. but I also want to expire session if the user is not doing any activity(idle) for 1 hour.

What is the modification required???
please help me

Thanks
gulan
#3

[eluser]thinkigniter[/eluser]
Check this out...
[email=http://plugins.jquery.com/project/timeout_interval_idle]http://plugins.jquery.com/project/timeout_interval_idle[/email]
#4

[eluser]gulan[/eluser]
Thanks for your reply... its a nice one..
but in my application I dont have any text box but i have some iframe windows. each iframe window has its own ids so how can i check the click event or button press event to check whether the user is idle or not??
#5

[eluser]thinkigniter[/eluser]
[quote author="gulan" date="1228839563"]Thanks for your reply... its a nice one..
but in my application I dont have any text box but i have some iframe windows. each iframe window has its own ids so how can i check the click event or button press event to check whether the user is idle or not??[/quote]

I haven't tested this but try something like this...


Code:
$('#iframeID').contents().find('#ID').click(
    function(){
      restart_timeout();//RESART TIMEOUT FUNCTION
    });

You'll have to know a little javascript to get this to work!

Have A Go...
#6

[eluser]gulan[/eluser]
Sorry it not working....
I am using extJs frame work, so I got some other command to get the Id,
but i have to check id of each window and some toolbars inside that window.

Now i come to know we can do it with http session, check the following code.

HTTP_Session:Confusedtart();
HTTP_Session:ConfusedetExpire(time() + 60 * 60); // expires in one hour
HTTP_Session:ConfusedetIdle(10 * 60); // idles in ten minutes
if (HTTP_Session::isExpired()) {
// expired
echo('Your session is expired!');
HTTP_Session::destroy();
}
if (HTTP_Session::isIdle()) {
// idle
echo('You've been idle for too long!');
HTTP_Session::destroy();
}
HTTP_Session::updateIdle();




will it work in codeigniter??? what are the changes required????
#7

[eluser]gulan[/eluser]
There is any file in codeigniter library or helper which loads if the user does any activity in his application???
like a header or footer???
otherwise how can I include such a file???
#8

[eluser]gulan[/eluser]
I read in codeigniter tutorial that session data will update every 5 minutes outomatically

Note: Session cookies are only updated every five minutes by default to reduce processor load. If you repeatedly reload a page you'll notice that the "last activity" time only updates if five minutes or more has passed since the last time the cookie was written. This time is configurable by changing the $config['time_to_update'] line in your system/config/config.php file.


but in my application its i can open some iframe windows, here session is not updating automatically it updates only if we close all iframe windows which is opened??


any way to update the session if user do any activity after a specified time??? that means if the user opens a window (in my application) 5 minutes after "last activity" then I want to update session?//
#9

[eluser]thinkigniter[/eluser]
Ok, A a general rule...

1. Javascript is a Browser side programming languauge
2. PHP is a server side {before browser loads} progamming language.

So, if php session variables will update when the page refreshs or reloads.

I sudjest you use a the EXT ajax object to send session timeout information to another CI controller.

That then kills the session information then returns true so that the EXT object
refresh/reload page -> N0 session -> logout
#10

[eluser]gulan[/eluser]
This is good one 1 think...Thanks ..

But the question is when should I send Ajax request...
how can I set time interval to send ajax request automatically??




Theme © iAndrew 2016 - Forum software by © MyBB