473,770 Members | 7,229 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

When/How PHP session expire? Can I set it in minutes of inactivity?

I would like to limit multiple logins for a user. How and when does
the session id expire? Can I set it so after x minutes of inactivity
it would expire. How do I check if session id exists? If I can do
these two things then I can store the session id for a user in a
database and everytime he requests an action I can just check if the
session id is active or expired. If active let him continue if
expired request to relogin. If the user tries to login and the
session id is active then reports that the id is still active and he
must either log out of the session or wait till it expires. How would
I accomplish this? Thanks

Ryan
Jul 17 '05 #1
4 39507
"Ryan Hubbard" <ry*********@ya hoo.com> wrote in message
news:59******** *************** ***@posting.goo gle.com...
I would like to limit multiple logins for a user. How and when does
the session id expire? Can I set it so after x minutes of inactivity
it would expire.


session_cache_e xpire();

How do I check if session id exists?

session_is_regi stered();
Jul 17 '05 #2
Is session_cache_e xpire the number of minutes from start to end or the
number of minutes from the last activity? Thanks for your help I
can't seem to find the answer in the PHP manual.

"rostik" <ro****@tower.n tu-kpi.kiev.ua> wrote in message news:<bv******* ***@news.ntu-kpi.kiev.ua>...
"Ryan Hubbard" <ry*********@ya hoo.com> wrote in message
news:59******** *************** ***@posting.goo gle.com...
I would like to limit multiple logins for a user. How and when does
the session id expire? Can I set it so after x minutes of inactivity
it would expire.


session_cache_e xpire();

How do I check if session id exists?

session_is_regi stered();

Jul 17 '05 #3
see session.gc_maxl ifetime, session.cookie_ lifetime in your php.ini.
If you are unable to edit it, see ini_set(); function

"Ryan Hubbard" <ry*********@ya hoo.com> wrote in message
news:59******** *************** ***@posting.goo gle.com...
Is session_cache_e xpire the number of minutes from start to end or the
number of minutes from the last activity? Thanks for your help I
can't seem to find the answer in the PHP manual.

"rostik" <ro****@tower.n tu-kpi.kiev.ua> wrote in message

news:<bv******* ***@news.ntu-kpi.kiev.ua>...
"Ryan Hubbard" <ry*********@ya hoo.com> wrote in message
news:59******** *************** ***@posting.goo gle.com...
I would like to limit multiple logins for a user. How and when does
the session id expire? Can I set it so after x minutes of inactivity
it would expire.


session_cache_e xpire();

How do I check if session id exists?

session_is_regi stered();

Jul 17 '05 #4
"rostik" <ro****@tower.n tu-kpi.kiev.ua> wrote in message news:<bv******* ***@news.ntu-kpi.kiev.ua>...
"Ryan Hubbard" <ry*********@ya hoo.com> wrote in message
news:59******** *************** ***@posting.goo gle.com...
I would like to limit multiple logins for a user. How and when does
the session id expire? Can I set it so after x minutes of inactivity
it would expire.


session_cache_e xpire();

How do I check if session id exists?

session_is_regi stered();


Are you really helping him??

To the OP:

Manual is your friend.
<http://in.php.net/manual/en/ref.session.php > Change your INI settings
to various values and learn.

Search the archive and Google for nice login scripts.

--
"Success = 10% sweat + 90% tears"
Email: rrjanbiah-at-Y!com
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
4412
by: Daniel Bengs | last post by:
Hi there... I've got a problem where a normal string variable loses its value after session_start() is called. The funny thing is, that this only happens for some people, and they are using IE6, but it does not happen with all versions of IE6. I've tested myself only with Mozilla and IE5, but the problem does not occur for me. I've got a username stored in $user, which is obtained from the $_POST variable, but after session_start() is...
5
2435
by: Jennifer Smith | last post by:
We have an environment running ASP on IIS5, where a user logs in via an ASP login page and an entry is made to the database recording the users login time and a database session. If the user then clicks the logout link, the database is update with their logout time and unlocks their account by removing the database session. The problem lies when the user closes the browser ("X"). When this happens, the IIS session is terminated, which...
24
2463
by: Nancy Drew | last post by:
hi all i'm trying to keep users from being able to login to a site twice at the same time. everytime a user does a login, i stick their userID into an application scoped array. if they try to login again, i bounce them to an error page. i use the session_onEnd sub within global.asa to remove their userID from the array at the end of their session, and this seems to work fine. however, if i just shut down the browser, the sub_onEnd...
2
3529
by: brian | last post by:
I have my session timeout at 20 minutes. Is there a way to set session time per variable. For instance: I create session("TEST") and I want it to expire in 2 minutes of no activity...Is that possible? For Clarification: If session time out in the web.config file is set to 20 minutes the session only times out if no activity occurs, right!
1
3092
by: caldera | last post by:
Hi, I want to check the session timeout finished in a minute. If there is a minute, it sends a web page to caution the users. If he/she want to continue he/she press the continue button . I was tried to thread but I can't sends the message window.Javascript is not suitable because I used the IFrame IFrames request are different. Is there any way sends to user these kinds of message without a response. Thanks for your helps.
4
8018
by: Daniel Geisenhoff | last post by:
Hi, we have set our session timeout in web.config and in IIS to 1 minute, but the session never expires. We check a variable Session("UserId") in global.asax, which is still valid after 10 minutes. here is our code in global.asax: Private Sub Global_AcquireRequestState(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.AcquireRequestState
12
6995
by: ACaunter | last post by:
Hi all, I was wondering how i could write some code which would automatically open the Login Page once the session has expired? -- AdamPC@hotmail.com
17
5216
by: jensen bredal | last post by:
Hello, i'm struggling with a somehow badly understood session scenario. I provide acces to my pages based on form authentication using Session cookies. Som of my pages are supposed to be running continuously and refreshing once an hour. I there set timeout= 61 in <sessionState section and on my page it says <meta http-equiv="refresh" content="3600">. I also set timeout=120 in the <forms section of web.config to make sure
0
4239
by: dadasurf80 | last post by:
Hello, I've a problem with Axis which gives me a "Session alreday invalidated" message after a time of inactivity. I use: - Tomcat : 4.1.29 - Axis : 1.3 - JVM : 1.4.2-b28 The complete message I recieved:
0
10058
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10004
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9870
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7416
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6678
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5450
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3972
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2817
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.