[php?] How does Vbulletin do it?
On my blog when ever you post a reply and then press refresh an alert comes up warning that if you refresh the page all form data will be resubmitted. I've found a workaround for it so that's not really a problem.
But if you submit a reply on vbulletin and then refresh no alert comes up, nor does the form get resubmitted. Which is exactly what I need for my blog, so I was wondering if anyone had an idea on how they did it?
Re: [php?] How does Vbulletin do it?
I highly suggest you visit vBulletin and post that interesting question on their forums. However, I think if you're referring to the "Quick Reply" box, it is possibly AJAX programmed?
Take a hard stern look in vBulletin's global javascript document:
http://forum.ragezone.com/clientscri...lobal.js?v=368
Re: [php?] How does Vbulletin do it?
Yeah, I already feared they used javascript/AJAX, which I'm trying not to use in my project because I'm not experienced with it. But I'll ask on their forums anyway.
Re: [php?] How does Vbulletin do it?
Their quickreply uses AJAX. What works also quite well is using a header redirect to the page where the submit came from:
PHP Code:
header("Location: " . $_SERVER['HTTP_REFERER']);
Add this after you've processed the POST data (ie, add a reply to the DB for example). The user will get redirected without knowing it and if he refreshes he will refresh the new page you redirected him to, which doesn't contain form data.
As for AJAX, a very good and easy to use toolkit is SAJAX, check out their examples :smile:
Re: [php?] How does Vbulletin do it?
Make it go to a different page, for example:
index.php?random=3845937
Not sure, but it has something to do with the redirecting. You need to clear the browsers cache of the form, works by going to one temp page, then back to the original too I guess.
Re: [php?] How does Vbulletin do it?
Quote:
Originally Posted by
FragFrog
Their quickreply uses AJAX. What works also quite well is using a header redirect to the page where the submit came from:
PHP Code:
header("Location: " . $_SERVER['HTTP_REFERER']);
Add this after you've processed the POST data (ie, add a reply to the DB for example). The user will get redirected without knowing it and if he refreshes he will refresh the new page you redirected him to, which doesn't contain form data.
Yeah, I already wondered why it never happened to my apps :P.
What basically happens with processing forms, is that it refreshes the page (or go to the location you specified), processes information (PHP) then gets to another page using headers. Atleast thats what I used to do :).
Re: [php?] How does Vbulletin do it?
Quote:
Originally Posted by
FragFrog
Their quickreply uses AJAX. What works also quite well is using a header redirect to the page where the submit came from:
PHP Code:
header("Location: " . $_SERVER['HTTP_REFERER']);
Add this after you've processed the POST data (ie, add a reply to the DB for example). The user will get redirected without knowing it and if he refreshes he will refresh the new page you redirected him to, which doesn't contain form data.
As for AJAX, a very good and easy to use toolkit is
SAJAX, check out their examples :smile:
Oh wow, thanks a bunch ff, that worked like a charm. Now I can remove my gay anti-flood protection.