eskimmer 0 Report post Posted August 17, 2007 HiWhats 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. Share this post Link to post Share on other sites
truefusion 3 Report post Posted August 17, 2007 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). Share this post Link to post Share on other sites
ewcreators 0 Report post Posted August 29, 2007 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. Share this post Link to post Share on other sites
truefusion 3 Report post Posted August 29, 2007 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? Share this post Link to post Share on other sites
ewcreators 0 Report post Posted August 29, 2007 Like i said above youredirects 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 alreadythis 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 helpif 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. Share this post Link to post Share on other sites
galexcd 0 Report post Posted September 6, 2007 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. Share this post Link to post Share on other sites
reconraiders 0 Report post Posted September 6, 2007 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 Share this post Link to post Share on other sites
galexcd 0 Report post Posted September 7, 2007 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 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. Share this post Link to post Share on other sites
reconraiders 0 Report post Posted September 7, 2007 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 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. Share this post Link to post Share on other sites
Tetraca 0 Report post Posted September 7, 2007 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 . 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. Share this post Link to post Share on other sites
jlhaslip 4 Report post Posted September 7, 2007 Could also, if you are writing the script, add a field to the user's table that has the last-post timestamp in it and check that time-stamp before continuing with the post being processed. You would need to update that timestamp on every successful post,though.If you aren't writing the script, going to a redirect page will only lag the Forum. Users won't like it.*edit*Or a javascript method???http://forums.xisto.com/no_longer_exists/ Share this post Link to post Share on other sites