mike1313 Posted March 30, 2007 Share Posted March 30, 2007 Is there anyway possible to stop a user from hitting the back button? Quote Link to comment Share on other sites More sharing options...
chronister Posted March 30, 2007 Share Posted March 30, 2007 To the best of my knowledge there is not. Javascript may help, but thats easily circumvented. Why do you want to do this? Quote Link to comment Share on other sites More sharing options...
mike1313 Posted March 30, 2007 Author Share Posted March 30, 2007 Well I have a page where the db gets updated, but if they go to a different page then click back, the page updates again. Quote Link to comment Share on other sites More sharing options...
chronister Posted March 30, 2007 Share Posted March 30, 2007 how is the update initiated? Do you use a $_GET variable, or a form button or what? I think that the solution would be not to try to disable navigation, but to make the code so that the update only happens when you want it to happen regardless of a user pressing a back button. Quote Link to comment Share on other sites More sharing options...
Lytheum Posted March 30, 2007 Share Posted March 30, 2007 After you update the database, you could register a session variable. Then do an if before you update to check and see if they've already did it. if( !session_is_registered(dbupdated)){ $sql = "UPDATE table etc.."; session_register("dbupdated"); }else{ echo "Already updated info."; } Not sure how secure this is, but it will help when they Refresh the page too, also causing the db to be updated again. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.