473,387 Members | 1,485 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,387 software developers and data experts.

HOW TO: make a session valid only as long as user on site?

gsb
I trying to use sessions to save a user name/id after login.
If the user leaves the site and comes back, how do I force a new session and
login?
Jul 16 '05 #1
6 3362
"gsb" <gs*@QWest.net> schrieb:
I trying to use sessions to save a user name/id after login.
If the user leaves the site and comes back, how do I force a new session and
login?


No chance.

Regards,
Matthias
Jul 16 '05 #2
> If the user leaves the site and comes back, how do I force a new session
and login?

use cookies for this.

Jul 16 '05 #3
"Bernhard Hörlberger" <sh********@netway.at> schrieb:
If the user leaves the site and comes back, how do I force a new session
and login?


use cookies for this.


And how do you know when to resume an existing session and when to
create a new session?

Regards,
Matthias
Jul 16 '05 #4
Terry Austin <ta*****@hyperbooks.com> schrieb:
Cookies have a time to live setting, referred to as the expire time. If
unset, the cookie automatically expires when the browser is closed.


That's OK, but the question was about "leaving the site". It seems like
problem of the definition of "leaving". Does "leave" mean, that you
closed the browser? Does it mean, that you did not show any activity in
the last 5 minutes?

So, if the nameless poster calling himself "gsb" tells us what he means
with "leaving", we might give him something which you could call a
solution.

Regards,
Matthias
Jul 16 '05 #5
Matthias Esken <mu************@usenetverwaltung.org> wrote in
news:bi**********@usenet.esken.de:
Terry Austin <ta*****@hyperbooks.com> schrieb:
Cookies have a time to live setting, referred to as the expire time. If
unset, the cookie automatically expires when the browser is closed.
That's OK, but the question was about "leaving the site". It seems like
problem of the definition of "leaving". Does "leave" mean, that you
closed the browser? Does it mean, that you did not show any activity in
the last 5 minutes?


I suspect it would *have* to mean one of those two.
So, if the nameless poster calling himself "gsb" tells us what he means
with "leaving", we might give him something which you could call a
solution.

Cookies could be used for either. If you don't set the expire time, the
session lasts until you close the browser. If you want to set a specific
time, set the expire time for the cookie to (for instance) five minutes in
the future. If he wants to have it expire if the user leaves the site to go
elsewhere, I suspect he's out of luck, because the protocol doesn't support
that (as far as I know).
--
Larry Flynt for Governor!
Bringing dignity back to the Governor's Mansion

Terry Austin
ta*****@hyperbooks.com
Jul 16 '05 #6
Terry Austin wrote:
Matthias Esken <mu************@usenetverwaltung.org> wrote in
news:bi**********@usenet.esken.de:
Terry Austin <ta*****@hyperbooks.com> schrieb:
Cookies have a time to live setting, referred to as the expire time. If
unset, the cookie automatically expires when the browser is closed.


That's OK, but the question was about "leaving the site". It seems like
problem of the definition of "leaving". Does "leave" mean, that you
closed the browser? Does it mean, that you did not show any activity in
the last 5 minutes?


I suspect it would *have* to mean one of those two.

So, if the nameless poster calling himself "gsb" tells us what he means
with "leaving", we might give him something which you could call a
solution.

Cookies could be used for either. If you don't set the expire time, the
session lasts until you close the browser. If you want to set a specific
time, set the expire time for the cookie to (for instance) five minutes in
the future. If he wants to have it expire if the user leaves the site to
go elsewhere, I suspect he's out of luck, because the protocol doesn't
support that (as far as I know).


Just have a sessions table with an expiry time, and extend it by a set number
of seconds (e.g. 480) each time they fetch a page. That way, they're automatically
logged out after (e.g.) 8 minutes of inactivity
Jul 16 '05 #7

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

Similar topics

27
by: mrbog | last post by:
Tell me if my assertion is wrong here: The only way to prevent session hijacking is to NEVER store authentication information (such as name/password) in the session. Well, to never authenticate...
1
by: mudge | last post by:
I'm running PHP Version 4.3.10. I'm trying to make it so that when a person logs in using a user name and password that their session is valid and continues for a few months so they don't have to...
3
by: Marcus | last post by:
Hello all, I have written numerous functions that check all user entered data on my site via POST and GET. My question is this: once my data checks out as being valid, I sometimes store it in...
3
by: Martin | last post by:
Hi all As my posting title suggests I'm having problems using InProc Session state in my ASP .NET app. I wrote a site for a friend which uses ADO .NET to keep track of a simple...
5
by: Just D. | last post by:
Do we have any access to the Session object from a different Session? The idea is to save Session of a current user and then if he logs in again then return the Session back. It's not a problem to...
5
by: Åženol Akbulak | last post by:
Hello; I use in my web application FormsAuthentication. Also I use Session state (InProc). When a user logged in, I can read Session parameters. (For example Session). Problem is that, when...
2
by: Gordon Burditt | last post by:
I had this idea about preventing session fixation, and I'm wondering what anyone else thinks about it. The idea is, essentially, don't allow session ids that YOUR PHP didn't generate (and aren't...
43
by: davidkoree | last post by:
I mean not about cookie. Does it have something to do with operating system or browser plugin? I appreciate any help.
2
by: Orgil | last post by:
I'm using ASP 3.0 however there is ASP.NET, because I'm working an old site that is built in ASP 3.0. I hope you for getting any help for my problem from you. So, my site's sessions are empty...
5
by: bgold12 | last post by:
When a user logs onto my site, I set some session data using php: .... session_start(); .... $_SESSION = 'value'; .... From what I understand, this should store the session data (i.e. the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.