Using php to rewrite the URL for refreshing issues
I know. I KNOW. OK? The way I have coded and put together my user management system is terrible. Im using actions. Now normally you would have another page handle the actio开发者_如何学JAVAns then redirect to the main page with the data but I havent done that. So currently, this is what occurs,
http://www.domain.com/index.php?action=newUser&id=1028
is refreshed and returns the error "That user already exists". Which is not that big of a deal. However.
http://www.domain.com/createblogpost.php?action=postNew
When the above is refreshed it results in a reproduced, identical post.
Is there a function or way I can get the php, at the end of the action=postNew
code snippet that would have the URL rewrote to www.domain.com/createblogpost.php
which would stop refresh injection.
Any ideas? Or any new paradigms of thought I havent considered? (inb4 dont code like a joke)
Thanks in advance, Aleski.
Send the Location
header...
header('Location: http://example.com/somewhere-else');
This pattern is known as Post/Redirect/Get.
header('Location: www.domain.com/createblogpost.php');
精彩评论