PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
vinoth
Forum Contributor
Posts: 113 Joined: Thu Aug 02, 2007 3:08 am
Location: India
Contact:
Post
by vinoth » Tue Sep 25, 2007 9:25 am
Hi
Now I am working with Sessions..
I have some doubt regarding that..
What is the max time we assign for session?
Is their any restriction or not..?
Please provide guidelines & suggestion regarding this.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Tue Sep 25, 2007 9:59 am
As much as you wish.
EricS
Forum Contributor
Posts: 183 Joined: Thu Jul 11, 2002 12:02 am
Location: Atlanta, Ga
Post
by EricS » Tue Sep 25, 2007 4:37 pm
Running the phpinfo() function will show you what your current session life time is. Remember, it's measured in seconds.
You can then adjust it using
1) ini_set()
2) a php directive in .htaccess
3) in your httpd.conf file
4) in the php.ini itself.
Which one you use depends on your needs and/or your permissions.
vinoth
Forum Contributor
Posts: 113 Joined: Thu Aug 02, 2007 3:08 am
Location: India
Contact:
Post
by vinoth » Wed Sep 26, 2007 9:29 am
ya
Currently i am using
ini_set() for set the session life time..
Which one is the best I can use ? Or everything works for same..
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Wed Sep 26, 2007 9:59 am
ini_set() is quite temporal and doesn't truely affect PHP's internal processes much in this regard.
It's often suggested to do it yourself artificially by storing a timestamp in the session so your code knows when to destroy it rather than hoping PHP will (since it's a triggered event.)
vinoth
Forum Contributor
Posts: 113 Joined: Thu Aug 02, 2007 3:08 am
Location: India
Contact:
Post
by vinoth » Thu Oct 04, 2007 5:58 am
hi all
Sorry for late reply..
I set the session Maxlife time as one hour but the client was not satisfied with that.
He does not want an Auto logout.. it should logout after the user clikck the logout button.
Is there any possible way to do that..
VladSun
DevNet Master
Posts: 4313 Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria
Post
by VladSun » Thu Oct 04, 2007 6:02 am
How many clients will you have?
There are 10 types of people in this world, those who understand binary and those who don't
vinoth
Forum Contributor
Posts: 113 Joined: Thu Aug 02, 2007 3:08 am
Location: India
Contact:
Post
by vinoth » Thu Oct 04, 2007 6:53 am
hi Viadsun
one client only make so many changes on daily updations..
Is it any possible way to solve this problem
VladSun
DevNet Master
Posts: 4313 Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria
Post
by VladSun » Thu Oct 04, 2007 7:01 am
There are 10 types of people in this world, those who understand binary and those who don't
vinoth
Forum Contributor
Posts: 113 Joined: Thu Aug 02, 2007 3:08 am
Location: India
Contact:
Post
by vinoth » Fri Oct 05, 2007 12:50 am
Is there any way to prevent session logout until the browser was closed
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Fri Oct 05, 2007 10:18 am
Set the life time our a long time.. maybe a month or five. Make sure the cookie is a session cookie (the expiry time is zero in session cookies.)
It's easier to control if you shift the handling out of PHP's direct, autonomous control like to a database.