Jump to content

Redirect - without resubmitting?


aceband

Recommended Posts

Hi there,

 

Currently I've got a login script that uses the typical if(isset($_POST['submit'])) and if its successful i use header("Location: page.page") to redirect to a new page and have the cookies loaded (manual says the cookies don't show until refresh i believe) but the problem is if they press the back button in their browser it asks if they want to resubmit the data - log in again although they are logged in. Although not a major problem for my login script i can see this being an issue when posting say new forum posts etc because i don't want to allow double posting etc.

 

How can i get around this?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/168500-redirect-without-resubmitting/
Share on other sites

Hi there,

 

Currently I've got a login script that uses the typical if(isset($_POST['submit'])) and if its successful i use header("Location: page.page") to redirect to a new page and have the cookies loaded (manual says the cookies don't show until refresh i believe) but the problem is if they press the back button in their browser it asks if they want to resubmit the data - log in again although they are logged in. Although not a major problem for my login script i can see this being an issue when posting say new forum posts etc because i don't want to allow double posting etc.

 

How can i get around this?

 

Thanks

I think its browser specific, i.e. there is now way to handle it so far i know. BTW why would someone hit browser's back button after they login?

As the previous poster said, it is a browser feature and you can't do anything about it. If you want to stop users from re-posting (it will be quite improbable anyway), create a cookie or session when the post is made and don't allow them to re-post if 1 minute has passed.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.