FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


how to prevent double post when user klik F5 *Refresh* ?





Philip
How to prevent double post when user klik F5 *Refresh* ?

I have a script php that i maded, btw when after a user posting or submit
and if is him/her that press F5, he/she can submit a double post,
how can i prevent this ?

Thanks
hexkid
Philip wrote:
I have a script php that i maded, btw when after a user posting or submit and if is him/her that press F5, he/she can submit a double post, how can i prevent this ?


Identify the post with a unique info, for instance, the md5 of the current date and session
Code:
<form ...>
<input type="hidden" name="uniqid" value="<?php echo md5(date('Hms').session_id()); ?>">
<!-- ... -->
</form>

In your PHP script you can choose to ignore double posts ...


One other option, which I see used much more often, is to deal with the post in a script that does not do any output, and then redirect so that when users press F5 they are refreshing the redirect GET and not the form submitted (POST).
Code:
<?php
// deal with $_POST
header('Location: redirected.php');
?>
hellrahul
Hey!

I just delete the double post. (if it is made by mistake). Cool

Script things are going above my head
Rolling Eyes
Related topics
Does anyone know how to get your site to appear higher ?
Windows Tips&tricks!
25 short cuts in Windows Xp
Double post
New insight into the automatic double-posting bug.
Double post!
Xandros OS 3.0.1 OC
how to prevent double post when user klik F5 *Refresh* ?
Some not so commonly asked questions.
the double post image
Windows shortcuts, must know
php link
Those who report a post/user should be rewarded..
Editing a post sometimes results in double-post
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.