I am developing a web application where I want to restrict update or insert more than once by navigating back to referring page. Let me present you three model files in the order of flow so that I can raise the zone where I am stuck.
register.html
<html> ... <form id="form1" name="form1" method="post" action="process.php"> <label for="textfield">Name</label> <input type="text" name="name" id="name" /> <input type="submit" name="Submit" value="Submit" /> </form> ... </html>
process.php
<?php echo "Welcome ".$_GET['para']; ?>
success.php
<?php if(isset($_POST['Submit'])) { $name = $_POST['name']; // some database update here ... echo "<a href='success.php?para=$name'>Done. Click to go next</a>"; unset($_POST['Submit']); }else{ echo "Error in submission"; } ?>
The above three files are very simple. Here the update part has nothing to do when the user hits the back button after landing on page success.php because of unset($_POST['Submit']);. But when the user goes back further by hitting the back button again it reaches register.html and can again come up with the $_POST['Submit'] set and may do the update part which is sometimes vulnerable. I know there is Post/Redirect/Get to solve this issue, but I want some other alternatives so that the part gatekeepering the update part may be made so efficient that it would not allow the same anymore by clicking the back button.