|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello!
I am having a webpage with a single index.php. I select subpages with a ?page=<name> query in URL. In these pages I use forms that have same URL for action. The functions then decide what to do based on passed valid $_POST variables and values. The problem occurs when user may press the BACK button of the browser. He is then asked wether to repost data. Naturally he will decide to repost. In these forms I add certain article-like information into MySQL database. The problem is how to detect if a repost has happened? Therefore I made an entry in the utility table (which I maintain for other purposes) where I track the number of last post. The form, however, reads this value from the database and passes it as hidden value. The form processing function compares this value to the one in the database, and if equal it proceeds with form processing and increases the post number. In this case if a repost has happened, the values would not be the same, and the functions will not actually insert same data into database. Any other solutions/advices/suggestions? Thanks! |
|
#2
|
|||
|
|||
|
When someone posts something, set a cookie with a brief (60 second) expire time, and don't allow them to post again until that cookie is gone.
if ($_COOKIE['postExpire']) print "You cannot repost"; |
|
#3
|
|||
|
|||
|
I am not sure that will solve the problem as users might repost even after 60secs are passed. It is crucial that a repost does not happen, so I must use a method that completely dissallows the reposting.
The method I derived works fine, even if several users post (different data) at the same time. I just wanted to ask if anyone has had some experience with it... Sessions won't work. It is important that posting information is read in the FORM, so that it can be passed as hidden value. In that case the single solution, as far as I see it, is to write that information somewhere, preferably MySQL dbase if applicable... Thanks for your answer, though! |
|
#4
|
|||
|
|||
|
Am getting the same problem
Have you found a solution to this problem yet? If so can you please let me know on sandm4n ( at ) msn ( dot ) com
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > PHP Repost from data problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|