Re: Session Security
From: nice.guy.nige (nigel_moss_at_deadspam.com)
Date: 07/20/04
- Next message: For example John Smith: "Re: If statements when submitting form"
- Previous message: 2metre: "Re: cgi and php"
- In reply to: bonehead: "Session Security"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 20 Jul 2004 12:41:15 +0100
While the city slept, bonehead (sendmenospam@here.org) feverishly typed...
[login script]
> 1. If a user, who has logged in successfully, navigates to another web
> site within the same browser session, and then attempts to use the
> Back button to return to the 'user_view.php' page within the same
> session,
> they will be redirected back to 'login.php' and required to log in
> again.
Hmm... My first thought was http_referrer, but that is not reliable. My
second thought, which may be better, was to pass a value to the page from
the links within your secure area, eg. <a
href="securepage.php?insite=true"> - then check to see if "insite" is set to
"true" in your pages. If not, log them out and redirect to the login page.
Still not completely secure though...
> 2. If the 'user_view.php' page remains static (i.e., no user
> interaction) for a fixed number of minutes (to be determined), the
> user
> is also redirected back to the login page.
When you start your session, write the current time stamp to the session.
Write a second value to the session which is the limit in seconds (so, for 5
minutes, 5*60 = 300). When a new page is opened, check the session, get a
new current time stamp, and if that is greater than the session time stamp +
the time limit, then the session has timed out. Log the user out and
redirect to the login page. Otherwise, write the new current time stamp to
the session and carry on. This is off the top of my head as I remember doing
it (fairly recently, but sleep and Marstons Pedigree have both occurred
since then!)
Hope that helps,
Nige
-- Nigel Moss http://www.nigenet.org.uk Mail address not valid. nigel@DOG.nigenet.org.uk, take the DOG. out! In the land of the blind, the one-eyed man is very, very busy!
- Next message: For example John Smith: "Re: If statements when submitting form"
- Previous message: 2metre: "Re: cgi and php"
- In reply to: bonehead: "Session Security"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|