Stop Double Post/submit

Pages: 1, 2
free web hosting
Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

Stop Double Post/submit

eskimmer
Hi

Whats the best way of stopping a double post from occurring? Re-directs?

I was hoping that there was another way because I am using smarty and with the current setup of my site implementing redirects would be a right pain.

Thanks for any help.

Reply

truefusion
Redirects will not stop double posting, for the info will still get submitted, and if the user has a connection problem and hits Send or Submit twice, it may get submitted twice or more (depending on how many submits the user has committed). Redirects are only helpful to prolong spam from happening and maybe other unknown reasons. The stopping of double posts is either dependent on the submitters' side or the webdesigner's JavaScript (you know, those scripts that render buttons useless after one click).

Reply

ewcreators
Not sure if its useful but anyways,
Its better to use redirect/ header('location:...'); rather than keeping the code on the same page.
Even if the user has a connection problem its better to be a little more safe the sorry.

Reply

truefusion
QUOTE(ewcreators @ Aug 29 2007, 03:16 AM) *
Its better to use redirect/ header('location:...'); rather than keeping the code on the same page.

Like i said above you—redirects won't work, for that page is the page that inserts the data into the database. All you're doing is splitting the code up. When the user submits a post, they are not shown the "add reply" page again with the submit button under the mouse. You don't have to wait till the next page loads up or even return back to you, so long as the server has received the information sent from and by the browser and everything validates, it's going into the database regardless on whether or not the user got to see the redirect page. Therefore, JavaScript is the most convenient option. Or you could write a script that checks to see if the same post has been submitted already—this would truly eliminate double posting (but is less convenient for the programmer), for what if the user agent has JavaScript disabled?

 

 

 


Reply

ewcreators
QUOTE(truefusion @ Aug 29 2007, 06:32 AM) *
Like i said above you—redirects won't work, for that page is the page that inserts the data into the database. All you're doing is splitting the code up. When the user submits a post, they are not shown the "add reply" page again with the submit button under the mouse. You don't have to wait till the next page loads up or even return back to you, so long as the server has received the information sent from and by the browser and everything validates, it's going into the database regardless on whether or not the user got to see the redirect page. Therefore, JavaScript is the most convenient option. Or you could write a script that checks to see if the same post has been submitted already—this would truly eliminate double posting (but is less convenient for the programmer), for what if the user agent has JavaScript disabled?


Well i just thought of another alternative :
how about using
if/else combined with mysql_affected_rows?
that could help
if it is one..then proceed , if it is more than it will stop the script and display an error message,
and then he can use a redirect. So if the user clicks more than once, he will get errors.

Reply

galexcd
On my forums I just have it set so you can't post more than once every 20 seconds. This prevents sombody who has a bad connection or accidently presses submit twice from actually sending the data twice becasue the second time would result in an error because that user just posted data less that 20 seconds before.

Reply

reconraiders
Depending on your forum system that you use, you might be able to find a plugin that will MERGE double posts by the same user. I know I have this plugin installed on my forums using MyBB system. You can even adjust settings like how much time between posts it has to be for them to be merged or what to use to separate the merged posts (<hr /> or something). Of course, if there isn't a plugin available for your software, you could always make one yourself wink.gif

Reply

galexcd
Well the problem with merging is if the user accidentally submitted the post twice the post would have the same text written twice in it, which in my opinion would be kind of inconvenient for the user to have to go back and edit it, but I guess it would be his fault in the first place that he clicked on the submit twice happy.gif But I don't know, if eskimmer is a php coder, he should be able to write his own solution probably based on some of the ideas some of us members have provided for him.

Reply

reconraiders
QUOTE(alex7h3pr0gr4m3r @ Sep 7 2007, 12:13 PM) *
Well the problem with merging is if the user accidentally submitted the post twice the post would have the same text written twice in it, which in my opinion would be kind of inconvenient for the user to have to go back and edit it, but I guess it would be his fault in the first place that he clicked on the submit twice happy.gif But I don't know, if eskimmer is a php coder, he should be able to write his own solution probably based on some of the ideas some of us members have provided for him.


Well that's why there is the time limit between posts. Two things are happening...
1. The user is not allowed to submit more than one post within a certain amount of time (30seconds or so)
2. If the last post is by the user that is posting now, the two posts will be merged.

That should pretty much cut out all the double posts. I'm sure there might still be some crazy circumstances that will allow double posts, but if you do those two things you pretty much prevent them.

Reply

Tetraca
The only way you're going to stop double posting is if you stop clicking the post button twice. If you don't do this, you'll never have a double post. A notice can do that very easily, although sometimes I doubt that people will read those notices tongue.gif. There are many times where I've had similar issues but since I never press the submit button twice, I never have the problem. I just know I need to go directly to the forum topic to find it.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Pages: 1, 2
Recent Queries:-
  1. how to stop double submit - 288.26 hr back. (1)
Similar Topics

Keywords : submit

  1. Getting Information From Submit Button - I need to grab information from a submit button. (1)
  2. Form Dosn't Submit In Opera - Works in IE and FireFox (1)
    My form dosn't submit, it works in IE and FF, its validated HTML 4.01 and all, Code:
    /**********************************/ /** Post Topic :: EvilBoard **/
    /**********************************/ /* Session Start */ session_start(); /* Start Submit Script */
    if ( isset($_POST )) { header("Refresh: 0; redirect.php?posttopic");
    define("RELOADED","YES"); } /* End Submit Script */ /* Include File::Header.php */
    include("include/header.php"); echo " "; /* If Script can't find SESSION user_name */ if (
    !$_SESSION ) { /* Echo :: Forbiden */ echo '...
  3. Submit Restrictions - Is there anyway to bypass this on my localhost? (21)
    This can be considered my first php page after a long while, I did a little basic php years ago and
    I have totally forgotten most of it. But I have come up with a page; a simple calculator if you will
    with the essential add, subtract, multiply and divide functions. When I load the page on my
    localhost, I get this error However when I upload it to trap17, there is no problem, please
    take a look http://darran.trap17.com/php/Calculator/calculator.php I know this does not matter
    but I want to find out where I went wrong on my first php page. The code listing for ...
  4. Request: Php Submit Script With Save In Host - Get Picture form url (13)
    Hi all i want make one form whit php , when users submit there urls , then my site give one picture
    form url and save on my host ! how can do that ? thanks...
  5. $_post Without A Form - Trying to post a value with using a submit button (9)
    Hey me again. Looks like im having trouble with php. THis time the solution should be easy but i
    just cant find it anywhere. I am trying to post a variable but i do not want to use a form because i
    hate the look of submit buttons for what i am using it for. I do not want to use javascript because
    of compatibility issues. If you know how to make a submit button look like a nomal text link that
    would work if you know how to send post data through an href that also would work. Or if you just
    know how to do it another way im open to suggestions. Thanks for all of your help...



Looking for stop, double, post, submit

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for stop, double, post, submit

*MORE FROM TRAP17.COM*
advertisement



Stop Double Post/submit



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE