473,396 Members | 1,918 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.

How to refresh login page after hitting back button results unwanted login

Note:
I'm not trying to prevent back button! So I'm looking for solution, not a patch.

Shortly:
How to prevent going backwards to login and then refreshing the page (thus resending the username and password of last user on the same computer) resulting a successfull login without knowing/typing in the credentials.

Little longer:
To make this simplier, say you only have 3 scripts: login.php, auth.php and page.php. In login.php you have a form asking for username and password. They're send to the auth.php and if they match, it'll show you the page.php content. If you log off when on page.php, you'll be end up back on login.php.

Now here's the problem: If after log out you'll keep going back (in borowser history or back button) long enough, it'll take you back where the un/pw was about to be sent to auth.php (sending method in this form is post). Since it was trying to send a form data (in this case un/pw) it'll tell you "Warning: Page has expired". If you hit F5 and choose retry, it'll resend whatever un/pw combination was tried earlier (since it's still stored in the form/post data) and will ultimately pass to page.php without typing in the un/pw again.

I've been trying to puzzle the sequence what must happen in the script and when in order to avoid such easy exploit. I have a decent security arsenal including sessions, crypted passwords, injection preventing, etc, but I don't get it how even the sessions would solve this, since that's when you're getting new session_id along with matched un/pw. For me it sounds like un/pw already typed in on some website and all you'd need to do is just hit enter to login. Like keys left in the car...

I must have missed something big time here! Any thoughts, links, solutions,...?
Nov 1 '10 #1
1 3723
code green
1,726 Expert 1GB
I think you need to take a look at
Expand|Select|Wrap|Line Numbers
  1. header("Location: page.php);
So do the DB process stuff, then call this function before any browser output.
Nov 2 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Dennis Allen | last post by:
Hi. On my online ordering form I use browser cookies to keep track of user items. My confirmation page reads: "If any of this information is incorrect, please go back to the order form and...
12
by: VB Programmer | last post by:
I know some sites will display the following message if you click on the BACK button in your browser. How do I implement this feature? Warning: Page has Expired The page you requested was...
1
by: James | last post by:
I'm getting the Warning: Page has Expired message when I hit the back button on my browser. I realize why this is happening, but ultimately this is going to severely annoy our client. Is there a...
1
by: gferreri | last post by:
Hi all, I've stumbled on an interesting problem with the way Firefox handles form submitting with the enter key. I'm putting together a page that has one form element with multiple controls...
1
by: ARAVIND999 | last post by:
PLEASE SEND THE SOURCE CODE FOR THE ABOVE MENTIONED STATEMENT.(i.e., HOW TO EXPIRE THE PAGE WHEN BACK BUTTON IS PRESSED)
12
by: jim.richardson | last post by:
Hi all, I'd like a page to be excluded from the back button history, that is, when a user hits their browser's back button, it never backs into this particular page. Can anybody please tell...
5
by: Shalini Bhalla | last post by:
i am writing a script to logout , its woking fine but , Back button takes me back to the page even after logout ............ how to solve this problem ?
2
viswammamilla
by: viswammamilla | last post by:
Hai i did one application ,its an intranet web application using asp.net and vb.net. Once user login into the application and did some task whenever user hits back button it will come back to one...
1
by: pulkit goel | last post by:
I am working on web application. I am facing a problem that when logout from my website i was redirected to my login page but when i click on back button of browser i was again able to access my web...
4
by: pulkit goel | last post by:
I am working on web application. I am facing a problem that when logout from my website i was redirected to my login page but when i click on back button of browser i was again able to access my web...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...

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.