PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 30th, 2003, 05:43 AM
vlad_k vlad_k is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Croatia
Posts: 13 vlad_k User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question PHP Repost from data problem

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!

Reply With Quote
  #2  
Old January 30th, 2003, 12:00 PM
crazytrain81 crazytrain81 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 232 crazytrain81 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
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";

Reply With Quote
  #3  
Old January 30th, 2003, 11:54 PM
vlad_k vlad_k is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Croatia
Posts: 13 vlad_k User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Smile

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!

Reply With Quote
  #4  
Old March 8th, 2004, 05:49 PM
SaNdM4n SaNdM4n is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 1 SaNdM4n User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > PHP Repost from data problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT