We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,151 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Clear login fields when redirecting back to login page after session timeout

I am a web developer who has just had PHP thrust upon me. I have created a login-protected site and have put a timeout script on each page which redirects the user back to the login page if they have left the site idle for a certain period of time. In Opera and Safari it works great but in Firefox the login page still has the login credentials in the text fields, so anyone could just press "login" and log right back into the site, which sort of defeats the purpose. Exhaustive Google searches have turned up nothing.

Any advice is much appreciated!

The timeout code I'm using is:
$inactive = 200;
if(isset($_SESSION) ) {
$session_life = time() - $_SESSION;
if($session_life > $inactive){
header("location: http://www.fakedomain.com/index.php");
}
}
$_SESSION = time();

2
Contributors
2
Replies
17 Hours
Discussion Span
1 Year Ago
Last Updated
3
Views
Question
Answered
cpchc
Newbie Poster
9 posts since Mar 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

try the autocomplete="off" attribute in the input tag, e.g.

<input type="textbox" name="username" id="username" autocomplete="off" />
diafol
Keep Smiling
Moderator
10,655 posts since Oct 2006
Reputation Points: 1,628
Solved Threads: 1,510
Skill Endorsements: 57

That worked perfectly! Thanks so much!

cpchc
Newbie Poster
9 posts since Mar 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Question Answered as of 1 Year Ago by diafol

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.3217 seconds using 2.67MB