user3128920
user3128920

Reputation: 419

disable back button in php page

I have a reponse url "reponse.php" is which after a trasaction is done,the banks response is posted to it and inturn display the status to the user whether trasaction is succesfull or not.But the problem is,when user lands in this,the back button is active and user can click on it and go back.I do want to disable this back button.Any ideas?

Upvotes: 1

Views: 1490

Answers (2)

ameenulla0007
ameenulla0007

Reputation: 2683

Check for $_SERVER['HTTP_REFERER']. It will return you the document refered URL. With that URL you can give the condition and disable the button.

Upvotes: 0

John Conde
John Conde

Reputation: 219924

The selected solution is wrong. This is not how to solve this problem. $_SERVER['HTTP_REFERER'] is not reliable. It can be spoofed and omitted which breaks this solution.

To prevent this you need to implement the POST/REDIRECT/GET pattern. Here is a tutorial that shows how it is done in PHP.

Upvotes: 3

Related Questions