473,382 Members | 1,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

php session expiry

Dear
I would like to set session expire time to 3hrs,
Which one is best ?
ini_set("session.cookie_lifetime","10800"); or session_set_cookie_params(3600 * 3);
Or can I use both?
Is it compulsary to place every page b4 where ever session_start();
And one more above said syntax is correct or not? because some people using "10800" and some '10800' others just 10800. how to set?

Thanks. Pls help me
Apr 5 '12 #1

✓ answered by johny10151981

both of them will do the same trick

but 10800 is better than 3600*3, php wont have to parse unnecessary equation. And yes you can use whichever you want.

Yes it is compulsory. in simple when you do session_start it creates all the necessary data list for you page purpose.

"10800" , '10800' and 10800

all of them are correct. it may have performance issue, i am not sure about it though.

but in some cases they will show difference

such as
("10800"==10800) will return 1 i.e. true

("10800"===10800) will return false

cause in the second comparison first data is treated as string and the second data is treated as number.

5 2043
johny10151981
1,059 1GB
both of them will do the same trick

but 10800 is better than 3600*3, php wont have to parse unnecessary equation. And yes you can use whichever you want.

Yes it is compulsory. in simple when you do session_start it creates all the necessary data list for you page purpose.

"10800" , '10800' and 10800

all of them are correct. it may have performance issue, i am not sure about it though.

but in some cases they will show difference

such as
("10800"==10800) will return 1 i.e. true

("10800"===10800) will return false

cause in the second comparison first data is treated as string and the second data is treated as number.
Apr 6 '12 #2
Great,
Thanks lot,
Then why there is two functions for same purpose?
anyway thanks once again. Let i work with this, If problem persists, I ll inform y.
Apr 6 '12 #3
Dear Friend,
I used session_set_cookie_params(10800); But now I am facing some problem. After 1 hr (on 65th min)even with activity (frequent clicks on page) at the time of submitting my page its expires, What may be problem? How to fix it?. I tried to work 45 min with activity and submit there is no expiry problem.
I am using shared hosting.
Apr 13 '12 #4
johny10151981
1,059 1GB
here is a suggestion from php.net site

Set cookie parameters defined in the php.ini file. The effect of this function only lasts for the duration of the script. Thus, you need to call session_set_cookie_params() for every request and before session_start() is called.
Apr 13 '12 #5
Yes, I using session_set_cookie_params(10800); before calling session_start .. each page. Wheter I need edit php.ini? And also I am attaching my current php.ini config file.
Thanks
Attached Files
File Type: doc PHP Version 5.doc (411.0 KB, 40141 views)
Apr 13 '12 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Anand | last post by:
Change the mode="stateServer" and Datasource = localhost.. instead of 127.0.0.1 Setting goes like this <SessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:42424"...
0
by: nbdy9(nospam) | last post by:
I have a ASP.Net website (mobile). From time to time the browser popup the following message. Anyway to catch the error and redirect to my start page? saying, login.aspx? Thanks. ...
1
by: Andy Fish | last post by:
Hi, I have an asp.net web app whereby I authenticate the user with Forms Authentication and store details about him in the session. I want to be able to catch an event when the users...
0
by: Amar | last post by:
Hi all, I am facing session expiry even after setting the session timeout to 60 minutes. This is happening only in windows 2003 system and is not happening in windows 2000 and IIS? Am I missing...
1
by: Aeron | last post by:
While pushing the back button user get relogined. How to prevent it.
2
sumittyagi
by: sumittyagi | last post by:
I am using websphere 5.1 and I want to set session timeout for my application. Now I know two ways of setting it (declaratively and programmatically). * declaratively in web.xml of the...
2
by: Muhammed Soyer | last post by:
Hi, I wonder whether any good mailing lists for C# and dotnet technologies exist or not. Do you follow any mailing lists for dotnet ? Thanks
2
by: fijsolam1981 | last post by:
Hi, I had created a web application where Session expiry was set to 2,000 minutes in IIS. in web config i had given like this <sessionState timeout="2,000" mode="InProc"></sessionStatebut MY web...
3
by: Moe Sisko | last post by:
Using dotnet 2.0 sp1, I've got ASP.NET session state working ok in SQLServer mode, but the sessions never seem to expire. e.g if I add a timeout attribute like so : <sessionState...
1
by: sazan | last post by:
Hi, I am new in java, i needed help in setting the expiry time for the session. I need the session to expire after 3 minutes, then show a table of the pages i visited during the 3 minutes and...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.