1,105,423 Community Members

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

Member Avatar
cpchc
Newbie Poster
9 posts since Mar 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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();

Member Avatar
diafol
Where are my eyes?
12,977 posts since Oct 2006
Reputation Points: 1,821 [?]
Q&As Helped to Solve: 1,848 [?]
Skill Endorsements: 92 [?]
Moderator
Featured
Sponsor
 
0
 

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

<input type="textbox" name="username" id="username" autocomplete="off" />
Member Avatar
cpchc
Newbie Poster
9 posts since Mar 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

That worked perfectly! Thanks so much!

Question Answered as of 2 Years Ago by diafol
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: