473,396 Members | 2,076 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,396 software developers and data experts.

automatic logout before SESSION end

Hello there,

On my site people have to log in and automatically start a session. An
authorized login grants access to other pages and MySQL data.
However when the user waits to long, the server ends the session, without a
proper logout. The user can't see that he is logged out, hits a button and
gets
mutiple errors because MySQL is no longer available.
Is there a way to to warn the user a minute before the session is ended?
I just read, the session time is set in session.gc_maxlifetime in php.ini.
So I
can let a timer run along with this time and warn the user, but doesn't the
server returns a signal before the session is ended that I can use to alert
the user or in any case can trigger a proper logout?

thanks, Chris
Oct 20 '05 #1
4 7777
>On my site people have to log in and automatically start a session. An
authorized login grants access to other pages and MySQL data.
However when the user waits to long,
the server ends the session,
*WHICH* server ends the *WHAT KIND OF* session? I presume you mean
MySQL server and the connection to it, not http server and PHP
$_SESSION, here.
without a
proper logout. The user can't see that he is logged out, hits a button and
gets
mutiple errors because MySQL is no longer available.
I'd like to suggest re-establishing the MySQL connection, if possible,
if it has timed out. Then there's no need to warn the user.
Is there a way to to warn the user a minute before the session is ended?
PHP runs server side. You can't push data to the browser. You could
tell the user his session has timed out, but it's a little late at
that point. Javascript is Turned Off(tm).
I just read, the session time is set in session.gc_maxlifetime in php.ini.


The maximum idle time for a MySQL connection is set in my.cnf or
a server default.

Gordon L. Burditt
Oct 20 '05 #2
Thanks Gordon, but it is in fact the http server (apache) that ends the PHP
$_SESSION!
The SQL errors occur because the user has no rights anymore to connect to
the MySQL server when the $_SESSION has ended.
I was hoping the http server would send some kind of alert, before ending
the PHP $_SESSION

Chris

"Gordon Burditt" <go***********@burditt.org> schreef in bericht
news:11*************@corp.supernews.com...
On my site people have to log in and automatically start a session. An
authorized login grants access to other pages and MySQL data.
However when the user waits to long,
the server ends the session,


*WHICH* server ends the *WHAT KIND OF* session? I presume you mean
MySQL server and the connection to it, not http server and PHP
$_SESSION, here.
without a
proper logout. The user can't see that he is logged out, hits a button and
gets
mutiple errors because MySQL is no longer available.


I'd like to suggest re-establishing the MySQL connection, if possible,
if it has timed out. Then there's no need to warn the user.
Is there a way to to warn the user a minute before the session is ended?


PHP runs server side. You can't push data to the browser. You could
tell the user his session has timed out, but it's a little late at
that point. Javascript is Turned Off(tm).
I just read, the session time is set in session.gc_maxlifetime in php.ini.


The maximum idle time for a MySQL connection is set in my.cnf or
a server default.

Gordon L. Burditt

Oct 20 '05 #3
You could use a javascript timer to either keep the session alive, or
to check the idle time.

Ian

Oct 21 '05 #4
On all session protected bages, create a function checklogon at the top
of the page. If the logon fails then redirect them back to the logon
screen (but perhaps pass the page they were on in the querystring, to
be used in the login script to redirect them back again)? I assume you
are checking the logon at some point on the secure pages anyway?

hope this helps

Cheers

Ian
www.boan-design.co.uk

Oct 21 '05 #5

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

Similar topics

7
by: Jack | last post by:
Hi, In my application, the main page is accessed via a login screen. A particular record is accessed based on the value of login page. Everything works fine. However, if this screen is kept idle...
4
by: ad | last post by:
I use the Login controls of Asp.net 2.0 in my program. I want to logout a user by program, I try Session.Abandon() for this. But I found that the user is the same after I execute Session.Abandon()....
2
by: AAOMTim | last post by:
I want to automatically logout if certain conditions occur in my application. Calling Session.Abandon() does not force a logout. What can I do? -- Tim
25
by: crescent_au | last post by:
Hi all, I've written a login/logout code. It does what it's supposed to do but the problem is when I logout and press browser's back button (in Firefox), I get to the last login page. In IE,...
1
by: shrik | last post by:
hi everybody. I have following problem. There are two pages. index.jsp and main.jsp in my application Index.jsp contains logging interface in . It submits password and userid to loginform bean. ...
1
by: Kandiman | last post by:
Hiya, i made a asp page, and one of my divs (as a include) is as below. the problem is if the main page is resubmitted, i get logged out again?... heres the code.. i think its on the value=true...
4
by: shahidrasul | last post by:
hi in my project when i click on logout anchor it goes to logout page and my code in logout page is if (Session != null) { Session = null; Session.Abandon(); ...
6
by: Thiago Macedo | last post by:
I could not find on the web a complete solution for this task. This is not the perfect solution, because it's doesn't have the ability to log the logout if browser crash or user leave it open while...
10
by: DavidPr | last post by:
When I logout as one user and log in under a different user, it opens with the last user's information. User 1 - Unsername: Davey Jones User 2 - Unsername: David Smith I log out from Davey...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.