Prevent Double Form Submit using Tokens
<p>I am trying to prevent the user from double submitting the forum by adding token hidden field.</p>

<p>So here is what I have done so far (before the forum loads I have this code to create a token with the current time as a value.</p>

<pre><code>$token = time();
setcookie('formToken', $token, time() + 3600);
</code></pre>

<p>in my forum I have a hidden input like this</p>

<pre><code>&lt;form method="post" action="'.$PHP_SELF.'?action=update"&gt;
&lt;input type="hidden" name="token" value="'.$token.'" /&gt;
&lt;input type="submit" value="go" /&gt;
&lt;/form&gt;
</code></pre>

<p>now on the top of my page where $action == "update" I have this code </p>

<pre><code>if(isset($_POST)  &amp;&amp;  ($_POST['token'] != $_COOKIE['formToken'])){
    $error_list .= '&lt;li&gt;You can not submit this forum twise.&lt;/li&gt;';
} 
</code></pre>

<p>if i hit F5 to refresh the page it submit the form again without displaying my error.</p>
