473,543 Members | 1,994 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_maxl ifetime 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 7795
>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_maxl ifetime 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.supe rnews.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_maxl ifetime 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
2136
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 (not sure for how long now), and then if I try to save, the following error message comes up: Error Type: Microsoft OLE DB Provider for ODBC Drivers...
4
11231
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(). I thought that Session.Abandon() can break the connection of current user, but I fail How can I logout a user by program?
2
1501
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
3296
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, when I press back button, I get to the page that says "Page has Expired" but Firefox does not do this. I think it's something to do with sessions...
1
14036
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. following are entries in struts-config.xml file <action input="index.jsp" name="loginform" path="/login" scope="session"...
1
3314
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 for the hidden textbox on the logout sub.. but how do i get round this? can i not change the value onclick? <div id=Rightbody> <!--<form...
4
3395
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(); Response.Clear(); FormsAuthentication.SignOut(); Response.Redirect("login.aspx"); }
6
5965
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 the session time out expires. So, any improvement would be apreciated. 1. Make the system frameable, by creating a frameset page with an...
10
4797
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 Jones, then login as David Smith the Welcome message below will show "Welcome Davey". And it will be Davey's information that is accessible - not David...
0
7355
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7594
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7746
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...
0
5889
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3394
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3394
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1830
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
1
979
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
648
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...

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.